|
|
Processes in the time-sharing class which are running in user mode (or in kernel mode before going to sleep) are scheduled according to the parameters in a time-sharing dispatcher parameter table (ts_dptbl). Processes in the inter-active scheduling class are also scheduled according to the parameters in the time-sharing dispatcher parameter table. (Time-sharing processes and inter-active processes running in kernel mode after sleeping are run within a special range of priorities reserved for such processes and are not affected by the parameters in the ts_dptbl until they return to user mode.) The ts_dptbl consists of an array (config_ts_dptbl[]) of parameter structures (struct tsdpent_t), one for each of the n priority levels used by time-sharing processes and inter-active processes in user mode. The structures are accessed via a pointer, (ts_dptbl), to the array. The properties of a given priority level i are specified by the ith parameter structure in this array (ts_dptbl[ i] ).
A parameter structure consists of the following members. These are also described in the /usr/include/sys/ts.h header.
An administrator can affect the behavior of the time-sharing portion of the scheduler by reconfiguring the ts_dptbl. Since processes in the time-sharing and inter-active scheduling classes share the same dispatch parameter table (ts_dptbl), changes to this table will affect both scheduling classes. 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 ts_quantum time quantum values. The resolution is specified as
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 parameter values for each of the time-sharing priority levels. The first line specifies the parameters for time-sharing level 0, the second line specifies the parameters for time-sharing level 1, etc. There must be exactly one line for each configured time-sharing priority level.
# Time-Sharing Dispatcher Configuration File RES=1000
# ts_quantum ts_tqexp ts_slpret ts_maxwait ts_lwait PRIORITY LEVEL
500 0 10 5 10 # 0
500 0 11 5 11 # 1
500 1 12 5 12 # 2
500 1 13 5 13 # 3
500 2 14 5 14 # 4
500 2 15 5 15 # 5
450 3 16 5 16 # 6
450 3 17 5 17 # 7
. . . . . . .
. . . . . . .
. . . . . . .
50 48 59 5 59 # 58
50 49 59 5 59 # 59
cc -c -0 -D_KERNEL ts_dptbl.c ld -r -o TS_DPTBL ts_dptbl.o
set TS:ts_maxupri=(value for max time-sharing user priority) set TS:ts_maxkmdpri=(number of kernel mode priorities - 1)
NOTE: Great care should be used in replacing the dispatch table using this method. If you do not get it right, panics may result, thus making the system unusable. The following is an example of a ts_dptbl.c file used for building the new ts_dptbl. /* BEGIN ts_dptbl.c */
#include <sys/proc.h> #include <sys/priocntl.h> #include <sys/class.h> #include <sys/disp.h> #include <sys/ts.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, "Time sharing dispatch table"
};
static struct modlinkage modlinkage = {
MODREV_1, &modlmisc, 0
};
_init()
{
return (mod_install(&modlinkage));
}
_info(modinfop)
struct modinfo *modinfop;
{
return (mod_info(&modlinkage, modinfop));
}
/*
* array of global priorities used by ts procs sleeping or
* running in kernel mode after sleep. Must have at least
* 40 values.
*/
pri_t config_ts_kmdpris[] = {
60,61,62,63,64,65,66,67,68,69,
70,71,72,73,74,75,76,77,78,79,
80,81,82,83,84,85,86,87,88,89,
90,91,92,93,94,95,96,97,98,99,
};
tsdpent_t config_ts_dptbl[] = {
/* glbpri qntm tqexp slprt mxwt lwt */
0, 100, 0, 10, 5, 10,
1, 100, 0, 11, 5, 11,
2, 100, 1, 12, 5, 12,
3, 100, 1, 13, 5, 13,
4, 100, 2, 14, 5, 14,
5, 100, 2, 15, 5, 15,
6, 100, 3, 16, 5, 16,
7, 100, 3, 17, 5, 17,
8, 100, 4, 18, 5, 18,
9, 100, 4, 19, 5, 19,
10, 80, 5, 20, 5, 20,
11, 80, 5, 21, 5, 21,
12, 80, 6, 22, 5, 22,
13, 80, 6, 23, 5, 23,
14, 80, 7, 24, 5, 24,
15, 80, 7, 25, 5, 25,
16, 80, 8, 26, 5, 26,
17, 80, 8, 27, 5, 27,
18, 80, 9, 28, 5, 28,
19, 80, 9, 29, 5, 29,
20, 60, 10, 30, 5, 30,
21, 60, 11, 31, 5, 31,
22, 60, 12, 32, 5, 32,
23, 60, 13, 33, 5, 33,
24, 60, 14, 34, 5, 34,
25, 60, 15, 35, 5, 35,
26, 60, 16, 36, 5, 36,
27, 60, 17, 37, 5, 37,
28, 60, 18, 38, 5, 38,
29, 60, 19, 39, 5, 39,
30, 40, 20, 40, 5, 40,
31, 40, 21, 41, 5, 41,
32, 40, 22, 42, 5, 42,
33, 40, 23, 43, 5, 43,
34, 40, 24, 44, 5, 44,
35, 40, 25, 45, 5, 45,
36, 40, 26, 46, 5, 46,
37, 40, 27, 47, 5, 47,
38, 40, 28, 48, 5, 48,
39, 40, 29, 49, 5, 49,
40, 20, 30, 50, 5, 50,
41, 20, 31, 50, 5, 50,
42, 20, 32, 51, 5, 51,
43, 20, 33, 51, 5, 51,
44, 20, 34, 52, 5, 52,
45, 20, 35, 52, 5, 52,
46, 20, 36, 53, 5, 53,
47, 20, 37, 53, 5, 53,
48, 20, 38, 54, 5, 54,
49, 20, 39, 54, 5, 54,
50, 10, 40, 55, 5, 55,
51, 10, 41, 55, 5, 55,
52, 10, 42, 56, 5, 56,
53, 10, 43, 56, 5, 56,
54, 10, 44, 57, 5, 57,
55, 10, 45, 57, 5, 57,
56, 10, 46, 58, 5, 58,
57, 10, 47, 58, 5, 58,
58, 10, 48, 59, 5, 59,
59, 10, 49, 59, 5, 59,
};
short config_ts_maxumdpri = sizeof (config_ts_dptbl)/16 - 1;
/*
* Return the address of config_ts_dptbl
*/
tsdpent_t *
ts_getdptbl()
{
return (config_ts_dptbl);
}
/*
* Return the address of config_ts_kmdpris
*/
int *
ts_getkmdpris()
{
return (config_ts_kmdpris);
}
/*
* Return the address of ts_maxumdpri
*/
short
ts_getmaxumdpri()
{
return (config_ts_maxumdpri);
}
/* END ts_dptbl.c */
No sanity checking is done on the ts_dptbl values specified in the TS_DPTBL loadable module. Specifying an inconsistent or nonsensical ts_dptbl configuration through the TS_DPTBL loadable module could cause serious performance problems and/or cause the system to panic.
|
|
Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97