1ts_dptbl(4)                      File Formats                      ts_dptbl(4)
2
3
4

NAME

6       ts_dptbl - time-sharing dispatcher parameter table
7

DESCRIPTION

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       Processes  in the time-sharing class which are running in user mode (or
27       in kernel mode before going to sleep) are scheduled  according  to  the
28       parameters  in  a  time-sharing  dispatcher parameter table (ts_dptbl).
29       Processes in the  inter-active  scheduling  class  are  also  scheduled
30       according  to  the  parameters in the time-sharing dispatcher parameter
31       table. (Time-sharing processes and inter-active  processes  running  in
32       kernel mode after sleeping are run within a special range of priorities
33       reserved for such processes and are not affected by the  parameters  in
34       the  ts_dptbl until they return to user mode.) The ts_dptbl consists of
35       an array  (config_ts_dptbl[])  of  parameter  structures  (struct  tsd‐
36       pent_t),  one  for  each  of the n priority levels used by time-sharing
37       processes and inter-active processes in user mode. The  structures  are
38       accessed  via  a pointer, (ts_dptbl), to the array. The properties of a
39       given priority level i are specified by the ith parameter structure  in
40       this array (ts_dptbl[ i] ).
41
42
43       A parameter structure consists of the following members. These are also
44       described in the /usr/include/sys/ts.h header.
45
46       ts_globpri    The global scheduling priority associated with this  pri‐
47                     ority  level.  The  mapping between time-sharing priority
48                     levels and global scheduling priorities is determined  at
49                     boot  time by the system configuration. ts_globpri is the
50                     only member of the ts_dptbl which cannot be changed  with
51                     dispadmin(1M).
52
53
54       ts_quantum    The  length of the time quantum allocated to processes at
55                     this level in ticks (hz).
56
57                     In the high resolution clock mode (hires_tick set to  1),
58                     the  value  of  hz  is  set to 1000. Increase quantums to
59                     maintain the same absolute time quantums.
60
61
62       ts_tqexp      Priority level of the new  queue  on  which  to  place  a
63                     process  running  at  the current level if it exceeds its
64                     time quantum. Normally this field links to a lower prior‐
65                     ity time-sharing level that has a larger quantum.
66
67
68       ts_slpret     Priority  level  of  the  new  queue  on which to place a
69                     process, that was previously in user mode at this  level,
70                     when  it  returns  to  user mode after sleeping. Normally
71                     this field links to a higher priority level  that  has  a
72                     smaller quantum.
73
74
75       ts_maxwait    A per process counter, ts_dispwait is initialized to zero
76                     each time  a  time-sharing  or  inter-active  process  is
77                     placed  back on the dispatcher queue after its time quan‐
78                     tum has expired or when it is  awakened  (ts_dispwait  is
79                     not reset to zero when a process is preempted by a higher
80                     priority process). This counter is incremented  once  per
81                     second  for  each process on a dispatcher or sleep queue.
82                     If a process' ts_dispwait value  exceeds  the  ts_maxwait
83                     value  for its level, the process' priority is changed to
84                     that indicated by ts_lwait. The purpose of this field  is
85                     to prevent starvation.
86
87
88       ts_lwait      Move  a process to this new priority level if ts_dispwait
89                     is greater than ts_maxwait.
90
91
92
93       An administrator can affect the behavior of the time-sharing portion of
94       the  scheduler  by  reconfiguring  the ts_dptbl. Since processes in the
95       time-sharing and inter-active scheduling classes share  the  same  dis‐
96       patch  parameter  table  (ts_dptbl),  changes to this table will affect
97       both scheduling classes. There are  two  methods  available  for  doing
98       this:  reconfigure with a loadable module at boot-time or by using dis‐
99       padmin(1M) at run-time.
100
101   ts_dptbl Loadable Module
102       The ts_dptbl can be reconfigured with a loadable module which  contains
103       a  new  time sharing dispatch table. The module containing the dispatch
104       table is separate from the TS loadable module which contains  the  rest
105       of  the time-sharing and inter-active software. This is the only method
106       that can be used to change the number of time-sharing  priority  levels
107       or the set of global scheduling priorities used by the time-sharing and
108       inter-active  classes.  The  relevant  procedure  and  source  code  is
109       described in the REPLACING THE TS_DPTBL LOADABLE MODULE section.
110
111   dispadmin Configuration File
112       With the exception of ts_globpri all of the members of the ts_dptbl can
113       be examined and modified on a running system  using  the  dispadmin(1M)
114       command.  Invoking dispadmin for the time-sharing or inter-active class
115       allows the administrator to retrieve the current ts_dptbl configuration
116       from  the  kernel's  in-core table, or overwrite the in-core table with
117       values from a configuration file. The configuration file used for input
118       to dispadmin must conform to the specific format described below.
119
120
121       Blank lines are ignored and any part of a line to the right of a # sym‐
122       bol is treated as a comment. The first non-blank, non-comment line must
123       indicate the resolution to be used for interpreting the ts_quantum time
124       quantum values. The resolution is specified as
125
126         RES=res
127
128
129
130       where res is a positive integer between 1 and  1,000,000,000  inclusive
131       and  the resolution used is the reciprocal of res in seconds (for exam‐
132       ple, RES=1000 specifies millisecond  resolution).  Although  very  fine
133       (nanosecond)  resolution may be specified, the time quantum lengths are
134       rounded up to the next integral multiple of the system clock's  resolu‐
135       tion.
136
137
138       The  remaining lines in the file are used to specify the parameter val‐
139       ues for each of the time-sharing priority levels. The first line speci‐
140       fies the parameters for time-sharing level 0, the second line specifies
141       the parameters for time-sharing level 1, etc. There must be exactly one
142       line for each configured time-sharing priority level.
143

EXAMPLES

145       Example 1 A Sample From a Configuration File
146
147
148       The  following  excerpt from a dispadmin configuration file illustrates
149       the format. Note that for each line  specifying  a  set  of  parameters
150       there  is  a comment indicating the corresponding priority level. These
151       level numbers indicate priority within the time-sharing and interactive
152       classes,  and the mapping between these time-sharing priorities and the
153       corresponding global scheduling priorities is determined by the config‐
154       uration specified in the ts master file. The level numbers are strictly
155       for the convenience of the administrator reading the file and, as  with
156       any  comment, they are ignored by dispadmin. dispadmin assumes that the
157       lines in the file are ordered by consecutive, increasing priority level
158       (from  0  to  the  maximum configured time-sharing priority). The level
159       numbers in the comments should normally agree with  this  ordering;  if
160       for some reason they don't, however, dispadmin is unaffected.
161
162
163         # Time-Sharing Dispatcher Configuration File RES=1000
164
165
166         # ts_quantum  ts_tqexp  ts_slpret  ts_maxwait  ts_lwait  PRIORITY
167         #                                                         LEVEL
168         500            0        10         5           10        # 0
169         500            0        11         5           11        # 1
170         500            1        12         5           12        # 2
171         500            1        13         5           13        # 3
172         500            2        14         5           14        # 4
173         500            2        15         5           15        # 5
174         450            3        16         5           16        # 6
175         450            3        17         5           17        # 7
176         .              .        .          .           .         . .
177         .              .        .          .           .         . .
178         .              .        .          .           .         . .
179         50             48       59         5           59        # 58
180         50             49       59         5           59        # 59
181
182
183       Example 2 Replacing The ts_dptbl Loadable Module
184
185
186       In  order  to  change  the size of the time sharing dispatch table, the
187       loadable module which contains the dispatch table information will have
188       to be built. It is recommended that you save the existing module before
189       using the following procedure.
190
191
192           1.     Place the dispatch table code shown below in a  file  called
193                  ts_dptbl.c An example of this file follows.
194
195           2.     Compile  the code using the given compilation and link lines
196                  supplied.
197
198                    cc -c -0 -D_KERNEL
199                    ts_dptbl.c
200                    ld -r -o TS_DPTBL ts_dptbl.o
201
202
203
204           3.     Copy  the  current  dispatch  table  in   /kernel/sched   to
205                  TS_DPTBL.bak.
206
207           4.     Replace the current TS_DPTBL in /kernel/sched.
208
209           5.     You  will  have  to  make changes in the /etc/system file to
210                  reflect the changes to the sizes of  the  tables.  See  sys‐
211                  tem(4).  The  two  variables  affected  are  ts_maxupri  and
212                  ts_maxkmdpri. The syntax for setting these is as follows:
213
214                    set TS:ts_maxupri=(value for max time-sharing user priority)
215                    set TS:ts_maxkmdpri=(number of kernel mode priorities - 1)
216
217
218
219           6.     Reboot the system to use the new dispatch table.
220
221
222       Great care should be used in replacing the dispatch  table  using  this
223       method.  If you do not get it right, panics may result, thus making the
224       system unusable.
225
226
227
228       The following is an example of a ts_dptbl.c file used for building  the
229       new ts_dptbl.
230
231
232         /* BEGIN ts_dptbl.c */
233         #include <sys/proc.h>
234         #include <sys/priocntl.h>
235         #include <sys/class.h>
236         #include <sys/disp.h>
237         #include <sys/ts.h>
238         #include <sys/rtpriocntl.h>
239         /*
240          * This is the loadable module wrapper.
241          */
242         #include <sys/modctl.h>
243         extern struct mod_ops mod_miscops;
244         /*
245          * Module linkage information for the kernel.
246          */
247         static struct modlmisc modlmisc = {
248              &mod_miscops, "Time sharing dispatch table"
249         };
250         static struct modlinkage modlinkage = {
251              MODREV_1, &modlmisc, 0
252         };
253         _init()
254         {
255              return (mod_install(&modlinkage));
256         }
257         _info(modinfop)
258              struct modinfo *modinfop;
259         {
260              return (mod_info(&modlinkage, modinfop));
261         }
262         /*
263          * array of global priorities used by ts procs sleeping or
264          * running in kernel mode after sleep. Must have at least
265          * 40 values.
266          */
267         pri_t config_ts_kmdpris[] = {
268                  60,61,62,63,64,65,66,67,68,69,
269                  70,71,72,73,74,75,76,77,78,79,
270                  80,81,82,83,84,85,86,87,88,89,
271                  90,91,92,93,94,95,96,97,98,99,
272         };
273         tsdpent_t config_ts_dptbl[] = {
274
275         /*  glbpri  qntm  tqexp  slprt  mxwt  lwt  */
276
277             0,      100,  0,     10,    5,    10,
278             1,      100,  0,     11,    5,    11,
279             2,      100,  1,     12,    5,    12,
280             3,      100,  1,     13,    5,    13,
281             4,      100,  2,     14,    5,    14
282             5,      100,  2,     15,    5,    15,
283             6,      100,  3,     16,    5,    16,
284             7,      100,  3,     17,    5,    17,
285             8,      100,  4,     18,    5,    18,
286             9,      100,  4,     19,    5,    19,
287             10,     80,   5,     20,    5,    20,
288             11,     80,   5,     21,    5,    21,
289             12,     80,   6,     22,    5,    22,
290             13,     80,   6,     23,    5,    23,
291             14,     80,   7,     24,    5,    24,
292             15,     80,   7,     25,    5,    25,
293             16,     80,   8,     26,    5,    26,
294             17,     80,   8,     27,    5,    27,
295             18,     80,   9,     28,    5,    28,
296             19,     80,   9,     29,    5,    29,
297             20,     60,   10,    30,    5,    30,
298             21,     60,   11,    31,    5,    31,
299             22,     60,   12,    32,    5,    33,
300             24,     60,   14,    34,    5,    34,
301             25,     60,   15,    35,    5,    35,
302             26,     60,   16,    36,    5,    36,
303             27,     60,   17,    37,    5,    37,
304             28,     60,   18,    38,    5,    38,
305             29,     60,   19,    39,    5,    39,
306             30,     40,   20,    40,    5,    40,
307             31,     40,   21,    41,    5,    41,
308             32,     40,   22,    42,    5,    42,
309             33,     40,   23,    43,    5,    43,
310             34,     40,   24,    44,    5,    44,
311             35,     40,   25,    45,    5,    45,
312             36,     40,   26,    46,    5,    46,
313             37,     40,   27,    47,    5,    47,
314             38,     40,   28,    48,    5,    48,
315             39,     40,   29,    49,    5,    49,
316             40,     20,   30,    50,    5,    50,
317             41,     20,   31,    50,    5,    50,
318             42,     20,   32,    51,    5,    51,
319             43,     20,   33,    51,    5,    51,
320             44,     20,   34,    52,    5,    52,
321             45,     20,   35,    52,    5,    52,
322             46,     20,   36,    53,    5,    53,
323             47,     20    37,    53,    5,    53,
324             48,     20,   38,    54,    5,    54,
325             49,     20,   39,    54,    5,    54,
326             50,     10,   40,    55,    5,    55,
327             51,     10,   41,    55,    5,    55,
328             52,     10,   42,    56,    5,    56,
329             53,     10,   43,    56,    5,    56,
330             54,     10,   44,    57,    5,    57,
331             55,     10,   45,    57,    5,    57,
332             56,     10,   46,    58,    5,    58,
333             57,     10,   47,    58,    5,    58,
334             58,     10,   48,    59,    5,    59,
335             59,     10,   49,    59,    5,    59,
336
337         };
338
339         short config_ts_maxumdpri = sizeof (config_ts_dptbl)/16 - 1;
340         /*
341          * Return the address of config_ts_dptbl
342          */
343         tsdpent_t *
344         ts_getdptbl()
345         {
346               return (config_ts_dptbl);
347         }
348
349         /*
350          * Return the address of config_ts_kmdpris
351          */
352          int *
353          ts_getkmdpris()
354         {
355               return (config_ts_kmdpris);
356         }
357
358         /*
359          * Return the address of ts_maxumdpri
360          */
361         short
362         ts_getmaxumdpri()
363         {
364                return (config_ts_maxumdpri);
365         }
366
367         /* END ts_dptbl.c */
368
369

SEE ALSO

371       priocntl(1), dispadmin(1M), priocntl(2), system(4)
372
373
374       System Administration Guide: Basic Administration
375
376
377       Programming Interfaces Guide
378

NOTES

380       dispadmin  does  some limited sanity checking on the values supplied in
381       the configuration file. The sanity checking is intended to ensure  that
382       the  new  ts_dptbl  values do not cause the system to panic. The sanity
383       checking does not attempt to analyze the effect  that  the  new  values
384       will have on the performance of the system. Unusual ts_dptbl configura‐
385       tions may have a dramatic negative impact on  the  performance  of  the
386       system.
387
388
389       No  sanity  checking  is  done  on the ts_dptbl values specified in the
390       TS_DPTBL loadable module. Specifying  an  inconsistent  or  nonsensical
391       ts_dptbl configuration through the TS_DPTBL loadable module could cause
392       serious performance problems and/or cause the system to panic.
393
394
395
396SunOS 5.11                        15 Oct 2002                      ts_dptbl(4)
Impressum