nightly: remove unused BINARCHIVE
[unleashed.git] / share / man / man4 / rt_dptbl.4
blobcc2362891f844e679dcdbd7ee0f7b317282c6c28
1 '\" te
2 .\" Copyright 1989 AT&T, Copyright (c) 2001, Sun Microsystems, Inc.  All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH RT_DPTBL 4 "Oct 15, 2002"
7 .SH NAME
8 rt_dptbl \- real-time dispatcher parameter table
9 .SH DESCRIPTION
10 .sp
11 .LP
12 The process scheduler (or dispatcher) is the portion of the kernel that
13 controls allocation of the \fBCPU\fR to processes. The scheduler supports the
14 notion of scheduling classes where each class defines a scheduling policy, used
15 to schedule processes within that class. Associated with each scheduling class
16 is a set of priority queues on which ready to run processes are linked. These
17 priority queues are mapped by the system configuration into a set of global
18 scheduling priorities which are available to processes within the class. The
19 dispatcher always selects for execution the process with the highest global
20 scheduling priority in the system. The priority queues associated with a given
21 class are viewed by that class as a contiguous set of priority levels numbered
22 from 0 (lowest priority) to \fIn\fR (highest priority\(ema configuration
23 dependent value). The set of global scheduling priorities that the queues for a
24 given class are mapped into might not start at zero and might not be
25 contiguous, depending on the configuration.
26 .sp
27 .LP
28 The real-time class maintains an in-core table, with an entry for each priority
29 level, giving the properties of that level. This table is called the real-time
30 dispatcher parameter table (\fBrt_dptbl\fR). The \fBrt_dptbl\fR consists of an
31 array (\fBconfig_rt_dptbl[]\fR) of parameter structures (\fBstruct
32 rtdpent_t\fR), one for each of the \fIn\fR priority levels. The structure are
33 accessed via a pointer, (\fBrt_dptbl\fR), to the array. The properties of a
34 given priority level \fIi\fR are specified by the \fIi\fRth parameter structure
35 in this array ( \fBrt_dptbl[\fR\fIi\fR\fB]\fR ).
36 .sp
37 .LP
38 A parameter structure consists of the following members. These are also
39 described in the \fB/usr/include/sys/rt.h\fR header file.
40 .sp
41 .ne 2
42 .na
43 \fB\fBrt_globpri\fR\fR
44 .ad
45 .RS 14n
46 The global scheduling priority associated with this priority level. The
47 \fBrt_globpri\fR values cannot be changed with \fBdispadmin\fR(8).
48 .RE
50 .sp
51 .ne 2
52 .na
53 \fB\fBrt_quantum\fR\fR
54 .ad
55 .RS 14n
56 The length of the time quantum allocated to processes at this level in ticks
57 (\fBhz\fR). The time quantum value is only a default or starting value for
58 processes at a particular level as the time quantum of a real-time process can
59 be changed by the user with the \fBpriocntl\fR command or the \fBpriocntl\fR
60 system call.
61 .sp
62 In the high resolution clock mode (\fBhires_tick\fR set to \fB1\fR), the value
63 of \fBhz\fR is set to \fB1000\fR. Increase quantums to maintain the same
64 absolute time quantums.
65 .RE
67 .sp
68 .LP
69 An administrator can affect the behavior of the real-time portion of the
70 scheduler by reconfiguring the \fBrt_dptbl\fR. There are two methods available
71 for doing this: reconfigure with a loadable module at boot-time or by using
72 \fBdispadmin\fR(8) at run-time.
73 .SS "rt_dptbl Loadable Module"
74 .sp
75 .LP
76 The \fBrt_dptbl\fR can be reconfigured with a loadable module which contains a
77 new real time dispatch table. The module containing the dispatch table is
78 separate from the RT loadable module which contains the rest of the real time
79 software. This is the only method that can be used to change the number of real
80 time priority levels or the set of global scheduling priorities used by the
81 real time class. The relevant procedure and source code is described in the
82 Examples section.
83 .SS "dispadmin Configuration File"
84 .sp
85 .LP
86 The \fBrt_quantum\fR values in the \fBrt_dptbl\fR can be examined and modified
87 on a running system using the \fBdispadmin\fR(8) command. Invoking
88 \fBdispadmin\fR for the real-time class allows the administrator to retrieve
89 the current \fBrt_dptbl\fR configuration from the kernel's in-core table, or
90 overwrite the in-core table with values from a configuration file. The
91 configuration file used for input to \fBdispadmin\fR must conform to the
92 specific format described below.
93 .sp
94 .LP
95 Blank lines are ignored and any part of a line to the right of a \fI#\fR symbol
96 is treated as a comment. The first non-blank, non-comment line must indicate
97 the resolution to be used for interpreting the time quantum values. The
98 resolution is specified as
99 .sp
100 .in +2
102 RES=\fIres\fR
104 .in -2
108 where \fIres\fR is a positive integer between 1 and 1,000,000,000 inclusive and
109 the resolution used is the reciprocal of \fIres\fR in seconds. (For example,
110 \fBRES=1000\fR specifies millisecond resolution.) Although very fine
111 (nanosecond) resolution may be specified, the time quantum lengths are rounded
112 up to the next integral multiple of the system clock's resolution.
115 The remaining lines in the file are used to specify the \fBrt_quantum\fR values
116 for each of the real-time priority levels. The first line specifies the quantum
117 for real-time level 0, the second line specifies the quantum for real-time
118 level 1. There must be exactly one line for each configured real-time priority
119 level. Each \fBrt_quantum\fR entry must be either a positive integer specifying
120 the desired time quantum (in the resolution given by \fIres\fR), or the value
121 -2 indicating an infinite time quantum for that level.
122 .SH EXAMPLES
124 \fBExample 1 \fRA Sample \fBdispadmin\fR Configuration File
127 The following excerpt from a \fBdispadmin\fR configuration file illustrates the
128 format. Note that for each line specifying a time quantum there is a comment
129 indicating the corresponding priority level. These level numbers indicate
130 priority within the real-time class, and the mapping between these real-time
131 priorities and the corresponding global scheduling priorities is determined by
132 the configuration specified in the \fBRT_DPTBL\fR loadable module. The level
133 numbers are strictly for the convenience of the administrator reading the file
134 and, as with any comment, they are ignored by \fBdispadmin\fR on input.
135 \fBdispadmin\fR assumes that the lines in the file are ordered by consecutive,
136 increasing priority level (from 0 to the maximum configured real-time
137 priority). The level numbers in the comments should normally agree with this
138 ordering; if for some reason they don't, however, \fBdispadmin\fR is
139 unaffected.
142 .in +2
144 # Real-Time Dispatcher Configuration File
145 RES=1000
147 # TIME QUANTUM PRIORITY
148 # (rt_quantum)LEVEL
149 100#   0
150 100#   1
151 100#   2
152 100#   3
153 100#   4
154 100#   5
155 90 #   6
156 90 #   7
157 \&..    .
158 \&..    .
159 \&..    .
160 10#   58
161 10#   59
163 .in -2
166 \fBExample 2 \fRReplacing The rt_dptbl Loadable Module
169 In order to change the size of the real time dispatch table, the loadable
170 module which contains the dispatch table information will have to be built. It
171 is recommended that you save the existing module before using the following
172 procedure.
174 .RS +4
177 Place the dispatch table code shown below in a file called \fBrt_dptbl.c\fR
178 An example of an \fBrt_dptbl.c\fR file follows.
180 .RS +4
183 Compile the code using the given compilation and link lines supplied.
185 .in +2
187 cc -c -0 -D_KERNEL rt_dptbl.c
188 ld -r -o RT_DPTBL rt_dptbl.o
190 .in -2
194 .RS +4
197 Copy the current dispatch table in \fB/usr/kernel/sched\fR to
198 \fBRT_DPTBL.bak\fR.
200 .RS +4
203 Replace the current \fBRT_DPTBL\fR in \fB/usr/kernel/sched\fR.
205 .RS +4
208 You will have to make changes in the \fB/etc/system\fR file to reflect the
209 changes to the sizes of the tables. See \fBsystem\fR(4). The \fBrt_maxpri\fR
210 variable may need changing. The syntax for setting this is:
212 .in +2
214 set RT:rt_maxpri=(class-specific value for maximum \e
215         real-time priority)
217 .in -2
220 .RS +4
223 Reboot the system to use the new dispatch table.
227 Great care should be used in replacing the dispatch table using this method. If
228 you don't get it right, the system may not behave properly.
232 The following is an example of a \fBrt_dptbl.c\fR file used for building the
233 new \fBrt_dptbl\fR.
236 .in +2
238 /*  BEGIN rt_dptbl.c  */
239 #include <sys/proc.h>
240 #include <sys/priocntl.h>
241 #include <sys/class.h>
242 #include <sys/disp.h>
243 #include <sys/rt.h>
244 #include <sys/rtpriocntl.h>
246  * This is the loadable module wrapper.
247  */
248 #include <sys/modctl.h>
249 extern struct mod_ops mod_miscops;
251  * Module linkage information for the kernel.
252  */
253 static struct modlmisc modlmisc = {
254         &mod_miscops, "realtime dispatch table"
256 static struct modlinkage modlinkage = {
257         MODREV_1, &modlmisc, 0
259 _init()
261         return (mod_install(&modlinkage));
263 _info (struct modinfo *modinfop)
265         return (mod_info(&modlinkage, modinfop));
267 rtdpent_t       config_rt_dptbl[] = {
269 /*   prilevel Time quantum  */
271 100,100,
272 101,100,
273 102,100,
274 103,100,
275 104,100,
276 105,100,
277 106,100,
278 107,100,
279 108,100,
280 109,100,
281 110,80,
282 111,80,
283 112,80,
284 113,80,
285 114,80,
286 115,80,
287 116,80,
288 117,80,
289 118,80,
290 119,80,
291 120,60,
292 121,60,
293 122,60,
294 123,60,
295 124,60,
296 125,60,
297 126,60,
298 127,60,
299 128,60,
300 129,60,
301 130,40,
302 131,40,
303 132,40,
304 133,40,
305 134,40,
306 135,40,
307 136,40,
308 137,40,
309 138,40,
310 139,40,
311 140,20,
312 141,20,
313 142,20,
314 143,20,
315 144,20,
316 145,20,
317 146,20,
318 147,20,
319 148,20,
320 149,20,
321 150,10,
322 151,10,
323 152,10,
324 153,10,
325 154,10,
326 155,10,
327 156,10,
328 157,10,
329 158,10,
330 159,10,
334  * Return the address of config_rt_dptbl
335  */ rtdpent_t *
336     rt_getdptbl()
338            return (config_rt_dptbl);
341 .in -2
343 .SH SEE ALSO
346 \fBpriocntl\fR(1), \fBdispadmin\fR(8), \fBpriocntl\fR(2), \fBsystem\fR(4)
349 \fISystem Administration Guide: Basic Administration\fR
352  \fIProgramming Interfaces Guide\fR