1rt_dptbl(4) File Formats rt_dptbl(4)
2
3
4
6 rt_dptbl - real-time dispatcher parameter table
7
9 The process scheduler (or dispatcher) is the portion of the kernel that
10 controls allocation of the CPU to processes. The scheduler supports the
11 notion of scheduling classes where each class defines a scheduling pol‐
12 icy, used to schedule processes within that class. Associated with each
13 scheduling class is a set of priority queues on which ready to run pro‐
14 cesses are linked. These priority queues are mapped by the system con‐
15 figuration into a set of global scheduling priorities which are avail‐
16 able to processes within the class. The dispatcher always selects for
17 execution the process with the highest global scheduling priority in
18 the system. The priority queues associated with a given class are
19 viewed by that class as a contiguous set of priority levels numbered
20 from 0 (lowest priority) to n (highest priority—a configuration depen‐
21 dent value). The set of global scheduling priorities that the queues
22 for a given class are mapped into might not start at zero and might not
23 be contiguous, depending on the configuration.
24
25
26 The real-time class maintains an in-core table, with an entry for each
27 priority level, giving the properties of that level. This table is
28 called the real-time dispatcher parameter table (rt_dptbl). The
29 rt_dptbl consists of an array (config_rt_dptbl[]) of parameter struc‐
30 tures (struct rtdpent_t), one for each of the n priority levels. The
31 structure are accessed via a pointer, (rt_dptbl), to the array. The
32 properties of a given priority level i are specified by the ith parame‐
33 ter structure in this array ( rt_dptbl[i] ).
34
35
36 A parameter structure consists of the following members. These are also
37 described in the /usr/include/sys/rt.h header file.
38
39 rt_globpri The global scheduling priority associated with this pri‐
40 ority level. The rt_globpri values cannot be changed with
41 dispadmin(1M).
42
43
44 rt_quantum The length of the time quantum allocated to processes at
45 this level in ticks (hz). The time quantum value is only
46 a default or starting value for processes at a particular
47 level as the time quantum of a real-time process can be
48 changed by the user with the priocntl command or the pri‐
49 ocntl system call.
50
51 In the high resolution clock mode (hires_tick set to 1),
52 the value of hz is set to 1000. Increase quantums to
53 maintain the same absolute time quantums.
54
55
56
57 An administrator can affect the behavior of the real-time portion of
58 the scheduler by reconfiguring the rt_dptbl. There are two methods
59 available for doing this: reconfigure with a loadable module at boot-
60 time or by using dispadmin(1M) at run-time.
61
62 rt_dptbl Loadable Module
63 The rt_dptbl can be reconfigured with a loadable module which contains
64 a new real time dispatch table. The module containing the dispatch ta‐
65 ble is separate from the RT loadable module which contains the rest of
66 the real time software. This is the only method that can be used to
67 change the number of real time priority levels or the set of global
68 scheduling priorities used by the real time class. The relevant proce‐
69 dure and source code is described in the Examples section.
70
71 dispadmin Configuration File
72 The rt_quantum values in the rt_dptbl can be examined and modified on a
73 running system using the dispadmin(1M) command. Invoking dispadmin for
74 the real-time class allows the administrator to retrieve the current
75 rt_dptbl configuration from the kernel's in-core table, or overwrite
76 the in-core table with values from a configuration file. The configura‐
77 tion file used for input to dispadmin must conform to the specific for‐
78 mat described below.
79
80
81 Blank lines are ignored and any part of a line to the right of a # sym‐
82 bol is treated as a comment. The first non-blank, non-comment line must
83 indicate the resolution to be used for interpreting the time quantum
84 values. The resolution is specified as
85
86 RES=res
87
88
89
90 where res is a positive integer between 1 and 1,000,000,000 inclusive
91 and the resolution used is the reciprocal of res in seconds. (For exam‐
92 ple, RES=1000 specifies millisecond resolution.) Although very fine
93 (nanosecond) resolution may be specified, the time quantum lengths are
94 rounded up to the next integral multiple of the system clock's resolu‐
95 tion.
96
97
98 The remaining lines in the file are used to specify the rt_quantum val‐
99 ues for each of the real-time priority levels. The first line specifies
100 the quantum for real-time level 0, the second line specifies the quan‐
101 tum for real-time level 1. There must be exactly one line for each con‐
102 figured real-time priority level. Each rt_quantum entry must be either
103 a positive integer specifying the desired time quantum (in the resolu‐
104 tion given by res), or the value -2 indicating an infinite time quantum
105 for that level.
106
108 Example 1 A Sample dispadmin Configuration File
109
110
111 The following excerpt from a dispadmin configuration file illustrates
112 the format. Note that for each line specifying a time quantum there is
113 a comment indicating the corresponding priority level. These level num‐
114 bers indicate priority within the real-time class, and the mapping
115 between these real-time priorities and the corresponding global sched‐
116 uling priorities is determined by the configuration specified in the
117 RT_DPTBL loadable module. The level numbers are strictly for the conve‐
118 nience of the administrator reading the file and, as with any comment,
119 they are ignored by dispadmin on input. dispadmin assumes that the
120 lines in the file are ordered by consecutive, increasing priority level
121 (from 0 to the maximum configured real-time priority). The level num‐
122 bers in the comments should normally agree with this ordering; if for
123 some reason they don't, however, dispadmin is unaffected.
124
125
126 # Real-Time Dispatcher Configuration File
127 RES=1000
128
129 # TIME QUANTUM PRIORITY
130 # (rt_quantum)LEVEL
131 100# 0
132 100# 1
133 100# 2
134 100# 3
135 100# 4
136 100# 5
137 90 # 6
138 90 # 7
139 .. .
140 .. .
141 .. .
142 10# 58
143 10# 59
144
145
146 Example 2 Replacing The rt_dptbl Loadable Module
147
148
149 In order to change the size of the real time dispatch table, the load‐
150 able module which contains the dispatch table information will have to
151 be built. It is recommended that you save the existing module before
152 using the following procedure.
153
154
155 1. Place the dispatch table code shown below in a file called
156 rt_dptbl.c An example of an rt_dptbl.c file follows.
157
158 2. Compile the code using the given compilation and link lines
159 supplied.
160
161 cc -c -0 -D_KERNEL rt_dptbl.c
162 ld -r -o RT_DPTBL rt_dptbl.o
163
164
165
166 3. Copy the current dispatch table in /usr/kernel/sched to
167 RT_DPTBL.bak.
168
169 4. Replace the current RT_DPTBL in /usr/kernel/sched.
170
171 5. You will have to make changes in the /etc/system file to
172 reflect the changes to the sizes of the tables. See sys‐
173 tem(4). The rt_maxpri variable may need changing. The syntax
174 for setting this is:
175
176 set RT:rt_maxpri=(class-specific value for maximum \
177 real-time priority)
178
179
180 6. Reboot the system to use the new dispatch table.
181
182
183 Great care should be used in replacing the dispatch table using this
184 method. If you don't get it right, the system may not behave properly.
185
186
187
188 The following is an example of a rt_dptbl.c file used for building the
189 new rt_dptbl.
190
191
192 /* BEGIN rt_dptbl.c */
193 #include <sys/proc.h>
194 #include <sys/priocntl.h>
195 #include <sys/class.h>
196 #include <sys/disp.h>
197 #include <sys/rt.h>
198 #include <sys/rtpriocntl.h>
199 /*
200 * This is the loadable module wrapper.
201 */
202 #include <sys/modctl.h>
203 extern struct mod_ops mod_miscops;
204 /*
205 * Module linkage information for the kernel.
206 */
207 static struct modlmisc modlmisc = {
208 &mod_miscops, "realtime dispatch table"
209 };
210 static struct modlinkage modlinkage = {
211 MODREV_1, &modlmisc, 0
212 };
213 _init()
214 {
215 return (mod_install(&modlinkage));
216 }
217 _info (struct modinfo *modinfop)
218 {
219 return (mod_info(&modlinkage, modinfop));
220 }
221 rtdpent_t config_rt_dptbl[] = {
222
223 /* prilevel Time quantum */
224
225 100,100,
226 101,100,
227 102,100,
228 103,100,
229 104,100,
230 105,100,
231 106,100,
232 107,100,
233 108,100,
234 109,100,
235 110,80,
236 111,80,
237 112,80,
238 113,80,
239 114,80,
240 115,80,
241 116,80,
242 117,80,
243 118,80,
244 119,80,
245 120,60,
246 121,60,
247 122,60,
248 123,60,
249 124,60,
250 125,60,
251 126,60,
252 127,60,
253 128,60,
254 129,60,
255 130,40,
256 131,40,
257 132,40,
258 133,40,
259 134,40,
260 135,40,
261 136,40,
262 137,40,
263 138,40,
264 139,40,
265 140,20,
266 141,20,
267 142,20,
268 143,20,
269 144,20,
270 145,20,
271 146,20,
272 147,20,
273 148,20,
274 149,20,
275 150,10,
276 151,10,
277 152,10,
278 153,10,
279 154,10,
280 155,10,
281 156,10,
282 157,10,
283 158,10,
284 159,10,
285
286 };
287 /*
288 * Return the address of config_rt_dptbl
289 */ rtdpent_t *
290 rt_getdptbl()
291 {
292 return (config_rt_dptbl);
293 }
294
295
297 priocntl(1), dispadmin(1M), priocntl(2), system(4)
298
299
300 System Administration Guide: Basic Administration
301
302
303 Programming Interfaces Guide
304
305
306
307SunOS 5.11 15 Oct 2002 rt_dptbl(4)