The real-time class maintains an in-core table, with an entry for each priority level, giving the properties of that level. This table is called the real-time dispatcher parameter table (rt_dptbl). The rt_dptbl consists of an array (config_rt_dptbl[]) of parameter structures (struct rtdpent_t), one for each of the n priority levels. The structure are accessed via a pointer, (rt_dptbl), to the array. The properties of a given priority level i are specified by the ith parameter structure in this array ( rt_dptbl[i] ).
A parameter structure consists of the following members. These are also described in the /usr/include/sys/rt.h header file.
An administrator can affect the behavior of the real-time portion of the scheduler by reconfiguring the rt_dptbl. There are two methods available for doing this: reconfigure with a loadable module at boot-time or by using dispadmin(1M) at run-time.
Blank lines are ignored and any part of a line to the right of a # symbol is treated as a comment. The first non-blank, non-comment line must indicate the resolution to be used for interpreting the time quantum values. The resolution is specified as
RES=res
where res is a positive integer between 1 and 1,000,000,000 inclusive and the resolution used is the reciprocal of res in seconds. (For example, RES=1000 specifies millisecond resolution.) Although very fine (nanosecond) resolution may be specified, the time quantum lengths are rounded up to the next integral multiple of the system clock’s resolution.
The remaining lines in the file are used to specify the rt_quantum values for each of the real-time priority levels. The first line specifies the quantum for real-time level 0, the second line specifies the quantum for real-time level 1, etc. There must be exactly one line for each configured real-time priority level. Each rt_quantum entry must be either a positive integer specifying the desired time quantum (in the resolution given by res), or the value -2 indicating an infinite time quantum for that level.
# Real-Time Dispatcher Configuration File RES=1000 # TIME QUANTUMPRIORITY# (rt_quantum)LEVEL100# 0100# 1100# 2100# 3100# 4100# 590 # 690 # 7.. ... ... .10# 5810# 59
.
- Place the dispatch table code shown below in a file called rt_dptbl.c An example of an rt_dptbl.c file follows.
.- Compile the code using the given compilation and link lines supplied.
.cc -c -0 -D_KERNEL rt_dptbl.c
ld -r -o RT_DPTBL rt_dptbl.o
- Copy the current dispatch table in /usr/kernel/sched to RT_DPTBL.bak.
.- Replace the current RT_DPTBL in /usr/kernel/sched.
.- You will have to make changes in the /etc/system file to reflect the changes to the sizes of the tables. See system(4) . The rt_maxpri variable may need changing. The syntax for setting this is:
.set RT:rt_maxpri=(class-specific value for maximum real-time priority)
- Reboot the system to use the new dispatch table.
NOTE: Great care should be used in replacing the dispatch table using this method. If you don’t get it right, the system may not behave properly.
The following is an example of a rt_dptbl.c file used for building the new
rt_dptbl.
/* BEGIN rt_dptbl.c */
#include <sys/proc.h> #include <sys/priocntl.h> #include <sys/class.h> #include <sys/disp.h> #include <sys/rt.h> #include <sys/rtpriocntl.h>
/* * This is the loadable module wrapper. */ #include <sys/modctl.h> extern struct mod_ops mod_miscops; /* * Module linkage information for the kernel. */ static struct modlmisc modlmisc = { &mod_miscops, "realtime dispatch table" }; static struct modlinkage modlinkage = { MODREV_1, &modlmisc, 0 }; _init() { return (mod_install(&modlinkage)); } _info (struct modinfo *modinfop) { return (mod_info(&modlinkage, modinfop)); } rtdpent_t config_rt_dptbl[] = { /* prilevelTime quantum */100,100,101,100,102,100,103,100,104,100,105,100,106,100,107,100,108,100,109,100,110,80,111,80,112,80,113,80,114,80,115,80,116,80,117,80,118,80,119,80,120,60,121,60,122,60,123,60,124,60,125,60,126,60,127,60,128,60,129,60,130,40,131,40,132,40,133,40,134,40,135,40,136,40,137,40,138,40,139,40,140,20,141,20,142,20,143,20,144,20,145,20,146,20,147,20,148,20,149,20,150,10,151,10,152,10,153,10,154,10,155,10,156,10,157,10,158,10,159,10, }; /* * Return the address of config_rt_dptbl */ rtdpent_t * rt_getdptbl() { return (config_rt_dptbl); } Files <sys/rt.h>