Annotation of researchv10dc/man/manx/share.5, revision 1.1.1.1

1.1       root        1: .TH SHARE 5 SHARE
                      2: .SH NAME
                      3: Share \- Share Scheduling on Unix
                      4: .SH SYNOPSIS
                      5: Scheduling for a share of the machine
                      6: .SH DESCRIPTION
                      7: .I Share
                      8: is a term covering those elements of the Unix kernel
                      9: that affect the priority of a user's job.
                     10: The basic scheduler in Unix schedules processes on a short term
                     11: .I per-process
                     12: basis.
                     13: The
                     14: .I "share scheduler"
                     15: takes account of the history of a user's
                     16: usage of the resources of the machine, and introduces a
                     17: .I per-user
                     18: long term scheduler.
                     19: To do this, several variables are available to the scheduler in a per-user data
                     20: structure known as an
                     21: .I lnode.
                     22: These record the intended share of the machine that the user should get,
                     23: the recent history of resources consumed (``usage''),
                     24: and the number of active (running) processes belonging to the user.
                     25: Together, these affect the priority of each of the processes
                     26: so that consumption of resources is adjusted toward the intended share.
                     27: .P
                     28: A user's
                     29: .I usage
                     30: is calculated by accumulating the charges incurred by use of resources,
                     31: and decaying the result over time.
                     32: The share scheduler affects the low-level scheduling of a user's processes
                     33: by adding the user's
                     34: .I usage
                     35: divided by the allocated share,
                     36: and multiplied by the active process count,
                     37: to the priority of a process
                     38: every time that process incurs a clock tick.
                     39: Since the larger its priority,
                     40: the less often a process is scheduled,
                     41: processes belonging to users with high
                     42: .IR usage ,
                     43: low share, or many active processes
                     44: will get a smaller share of resources.
                     45: Note that at any one time, a user can use all of the resources available
                     46: provided there is no competition from others.
                     47: .SS "SCHEDULING GROUPS"
                     48: .I lnodes
                     49: are organised into a tree.
                     50: For any particular sub-tree,
                     51: the sub-tree's share of resources
                     52: is divided up between the
                     53: lnodes
                     54: according to their relative shares.
                     55: Sub-trees are also known as groups.
                     56: The root
                     57: .I lnode
                     58: of the group is the group owner,
                     59: and the leaf
                     60: .I lnodes
                     61: are its users.
                     62: The total shares issued to the group include both those issued to the owner,
                     63: as well as those issued to the users.
                     64: Both owner and users are known as group members.
                     65: The share of the group's resources
                     66: allocated to any particular member of the group
                     67: is in the proportion
                     68: of the member's shares divided by the group's shares.
                     69: .P
                     70: The most interesting group is the one at the top of the tree,
                     71: whose owner is ``root'',
                     72: and its group members are the primary scheduling groups.
                     73: \&``root''
                     74: gets 100% of the available resources,
                     75: which is split as above between the primary scheduling groups.
                     76: .P
                     77: Not all group owners represent real users,
                     78: and in these cases there is no need to allocate them a share of resources.
                     79: Such lnodes are indicated by the \s-1NOTSHARED\s0 flag,
                     80: which causes the scheduler to ignore their shares when allocating
                     81: their group's resources among its members.
                     82: However,
                     83: the long term
                     84: .I charge
                     85: of a group owner
                     86: always includes all the charges levied on any member of its group.
                     87: .P
                     88: For reasons of system management,
                     89: \&``root'' is always allocated 100% of the resources whenever it needs them.
                     90: However, since all real users run on their own lnodes,
                     91: the \s-1NOTSHARED\s0 flag is turned on for ``root'',
                     92: and thus the primary scheduling groups
                     93: have 100% of the available resources to share between themselves.
                     94: However, for instrumentation purposes,
                     95: ``root''s
                     96: .I charge
                     97: only represents its own consumption of resources,
                     98: but the total consumption of resources is accumulated in the
                     99: .I kl_temp
                    100: field of
                    101: \&``root''s
                    102: .I kern_lnode
                    103: (see
                    104: .IR lnode (5)
                    105: for details of a
                    106: .IR kern_lnode .)
                    107: .SS CHARGES
                    108: Charges making up the accumulating usage figure
                    109: are levied by default as follows:-
                    110: .RS
                    111: .PD 0
                    112: .TP "\w'system servicesXX'u"
                    113: cpu
                    114: 100%
                    115: .TP
                    116: disk i/o
                    117: 0%
                    118: .TP
                    119: terminal i/o
                    120: 0%
                    121: .TP
                    122: system services
                    123: 0%
                    124: .TP
                    125: memory
                    126: 0%
                    127: .PD
                    128: .RE
                    129: .P
                    130: Memory charges are levied every scheduler cycle,
                    131: but note that 
                    132: .I root
                    133: is never charged for the memory it uses.
                    134: These charges can be varied at different times of the day to reflect
                    135: their popularity by using the command
                    136: .IR charge (1).
                    137: .P
                    138: Usage is decayed at an exponential rate intended to ensure that
                    139: all users of the machine get an equal chance to compete for resources
                    140: over a particular time period.
                    141: The default decay results in a
                    142: .I half-life
                    143: of 2 minutes.
                    144: Use
                    145: .IR charges (1)
                    146: to find out the current decay rate and resource charges.
                    147: .SS NICE
                    148: The
                    149: .IR nice (2)
                    150: system call has a slightly different effect under Share.
                    151: The
                    152: .I nice
                    153: parameter for a process now affects the rate at which its priority decays
                    154: to a higher priority over time.
                    155: .I Nicing
                    156: a process will make it run slower,
                    157: by reducing its effective share of the resources,
                    158: but it may not run slower than another user's processes
                    159: if that user has an even lower effective share of the resources.
                    160: However, processes with a
                    161: .I nice
                    162: priority of 19 are guaranteed only to run when no other processes need the CPU.
                    163: .I Niced
                    164: processes are charged less for CPU time than normal processes,
                    165: priority 19 processes are charged almost nothing for CPU time.
                    166: .SS MANAGEMENT
                    167: There are three flags that control the operation of the share scheduler.
                    168: .TP "\w'LIMSHAREXX'u"
                    169: .SM NOSHARE
                    170: This turns off the scheduler.
                    171: Since this will leave the parameters in a ``frozen'' state,
                    172: it should probably only be done at system boot time.
                    173: This flag is on by default when the system is booted,
                    174: so the command
                    175: .IR charge (1)
                    176: must be run to activate the scheduler.
                    177: Note that the program
                    178: .IR login (8)
                    179: won't attach users to their own
                    180: .I lnodes
                    181: while this flag is on,
                    182: instead each user will remain attached to
                    183: .IR root 's
                    184: lnode.
                    185: [Value 01]
                    186: .TP
                    187: .SM ADJGROUPS
                    188: This flags turns on global group effective share adjustment.
                    189: If any group is found to be getting less than
                    190: .SM MINGSHARE
                    191: times its allocated share,
                    192: then the costs incurred by its members are reduced proportionately.
                    193: [Value 02]
                    194: .TP
                    195: .SM LIMSHARE
                    196: This flag deals with an 
                    197: ``edge effect''
                    198: that occurs when users first log in.
                    199: It may be that their
                    200: .I usage
                    201: field has decayed to the point where they might temporarily be allocated
                    202: nearly 100% of the machine.
                    203: This flag limits any one user's share of the resources to no more than
                    204: MAXUSHARE times their intended share.
                    205: Of course, this still may be nearly 100%, if no other users are logged in,
                    206: or the other users have very small shares.
                    207: [Value 04]
                    208: .P
                    209: The
                    210: .IR charge (1)
                    211: command is used to manipulate these flags, and the charging parameters above.
                    212: There are also other parameters which may be changed with
                    213: .IR charge :-
                    214: .TP "\w'MAXNORMUSAGEXX'u"
                    215: .BI DecayRate
                    216: The decay rate for users'
                    217: .IR "active process rates" .
                    218: This parameter is calculated by counting the active proceses
                    219: per user every clock scan,
                    220: and is decayed every clock scan.
                    221: The usual value for this should result in a
                    222: .I half-life
                    223: for the rate of about 10 seconds.
                    224: .TP
                    225: .BI DecayUsage
                    226: The decay rate for users' usages.
                    227: This may be altered to produce a
                    228: .I half-life
                    229: for usage ranging from a few seconds to many days.
                    230: .TP
                    231: .BI Delta
                    232: The run frequency of the share scheduler in seconds.
                    233: The default value of 4 is fine.
                    234: .TP
                    235: .BI MAXGROUPS
                    236: This sets the maximum group nesting (depth of scheduling tree) allowed,
                    237: not including ``root''s group.
                    238: .TP
                    239: .BI MAXPRI
                    240: Absolute upper bound for a process's priority.
                    241: .TP
                    242: .BI MAXUPRI
                    243: Upper bound for normal processes' priorities.
                    244: .I Idle
                    245: processes run with priorities in the range
                    246: \s-1MAXUPRI\s0 < \fIpri\fP < \s-1MAXPRI\s0.
                    247: .TP
                    248: .BI MAXUSAGE
                    249: Upper bound for ``reasonable'' usages.
                    250: Users with usages larger than this are grouped together and given
                    251: process priorities
                    252: which prevent them from interfering with ``normal'' users.
                    253: The usage
                    254: (multiplied by the
                    255: .IR "active process rate" )
                    256: is added to a running process's priority
                    257: every time it incurs a clock tick,
                    258: so the upper bound should be small enough not to overrun the value
                    259: .SM MAXUPRI
                    260: in too short a time interval
                    261: .TP
                    262: .BI MAXUSERS
                    263: Sets the maximum number of users and groups that can be active.
                    264: Note that this cannot exceed the maximum configured in the kernel.
                    265: .TP
                    266: .BI PriDecay
                    267: This is the decay rate for maximally niced processes.
                    268: A reasonable minimum value for the
                    269: .I half-life
                    270: is about 100 seconds,
                    271: but see the comment for 
                    272: .SM MAXUSAGE
                    273: above.
                    274: .TP
                    275: .BI PriDecayBase
                    276: The base for calculating the decay rate
                    277: for process priorities with normal \fInice\fP.
                    278: This should be set low enough so that the priorities of processes
                    279: for users with low share don't decay too quickly.
                    280: A reasonable minimum value for the
                    281: .I half-life
                    282: is about 2 seconds.
                    283: .SH FILES
                    284: .PD 0
                    285: .TP "\w'/usr/include/sys/charges.hXX'u"
                    286: .IR /usr/include/sys/share.h
                    287: Definition of scheduler parameters.
                    288: .TP
                    289: .IR /usr/include/sys/charges.h
                    290: Default scheduler parameters.
                    291: .PD
                    292: .SH "SEE ALSO"
                    293: charge(1),
                    294: pl(1),
                    295: rates(1),
                    296: shstats(1),
                    297: ustats(1),
                    298: lnode(5),
                    299: shares(5),
                    300: login(8),
                    301: sharer(8).
                    302: .SH REFERENCES
                    303: "Scheduling for a Share of the Machine", J Larmouth, SP&E, Vol 5 1975 pp 29-49
                    304: .br
                    305: "Scheduling for Immediate Turnaround", J Larmouth, SP&E, Vol 8 1978 pp 559-578
                    306: .br
                    307: "A Fair Share Scheduler", J Kay & P Lauder, TM 11275-870319-01
                    308: .br
                    309: "Share Scheduler Administration", P Lauder

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.