]> git.lizzy.rs Git - plan9front.git/blob - sys/man/9/sched
ndb/dns: allow multiple txt, nullrr, cert, key and sig records (thanks kvik)
[plan9front.git] / sys / man / 9 / sched
1 .TH SCHED 9
2 .SH NAME
3 anyhigher, anyready, hzsched, procpriority, procrestore, procsave, scheddump, schedinit, sched, yield
4 \– scheduler interactions
5 .SH SYNOPSIS
6 .ta \w'\fLchar* 'u +10n +8n +8n
7 .EX
8 int     anyhigher(void)
9 int     anyready(void)
10 void    hzsched(void)
11 void    procpriority(Proc *p, int priority, int fixed)
12 void    procrestore(Proc *p)
13 void    procsave(Proc *p)
14 void    procwired(Proc *p, int machno)
15 void    scheddump(void)
16 void    schedinit(void)
17 void    sched(void)
18 void    yield(void)
19
20 enum {
21 ...
22         Npriq           = 20,   /* scheduler priority levels */
23         PriNormal       = 10,   /* base for normal processes */
24         PriKproc        = 13,   /* base for kernel processes */
25         PriRoot = 13,   /* base for root processes */
26 };
27 .EE
28 .SH DESCRIPTION
29 .PP
30 These functions define the priority process scheduler's interface.
31 Processes are scheduled strictly by priority, and processor affinity.
32 When possible, processes with no affinity will be rescheduled on the
33 same processor.  Within a priority, scheduling is round–robin.
34 Long–running processes of the same priority are preempted and
35 rescheduled.  But cpu use (or lack thereof) may adjust the priority up
36 or down, unless it has been explicitly fixed.  Kernel processes are
37 started with
38 .B PriKproc
39 while user processes start with
40 .BR PriNormal .
41 .PP
42 .I Anyhigher
43 returns true if any higher priority processes are runnable, while
44 .I anyready
45 returns true if any processes are runnable at all.
46 .I Yield
47 gives up the processor and pretends to consume ½ clock tick, while
48 .I sched
49 invokes the scheduler, potentially recursively.
50 .I Sched
51 may be called outside process context.  Either may return immediately.
52 .I Schedinit
53 initializes scheduling on the running processor.
54 .PP
55 .I Procpriority
56 sets a process' priority directly.  Fixed–priority processes are not
57 reprioritized based on cpu use.
58 .I Procwired
59 makes a process runnable only on a single processor.
60 .PP
61 .I Hzsched
62 is called by the clock routine on every tick to collect statistics.
63 Periodically (typically once a second)
64 .I hzsched
65 reprioritizes based on cpu use.
66 .PP
67 .I Procsave
68 and
69 .I procrestore
70 are architecture–dependent routines used by the scheduler to save and
71 restore processes.
72 .I Scheddump
73 prints scheduler statistics.
74 .SH SOURCE
75 .B /sys/src/9/port/proc.c
76 .sp 0.3
77 .I Procsave
78 and
79 .I procrestore
80 can be found at
81 .br
82 .B /sys/src/9/*/main.c
83 .br
84 .B /sys/src/9/*/arch.c
85 .br
86 .B /sys/src/9/*/trap.c
87 .SH SEE ALSO
88 .IR edf (9),
89 .IR sleep (9)