1 | @c |
---|
2 | @c COPYRIGHT (c) 1988-1999. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @chapter Scheduler Manager |
---|
10 | |
---|
11 | @section Introduction |
---|
12 | |
---|
13 | The scheduler manager ... |
---|
14 | |
---|
15 | The directives provided by the scheduler manager are: |
---|
16 | |
---|
17 | @itemize @bullet |
---|
18 | @item @code{sched_get_priority_min} - Get Minimum Priority Value |
---|
19 | @item @code{sched_get_priority_max} - Get Maximum Priority Value |
---|
20 | @item @code{sched_rr_get_interval} - Get Timeslicing Quantum |
---|
21 | @item @code{sched_yield} - Yield the Processor |
---|
22 | @end itemize |
---|
23 | |
---|
24 | @section Background |
---|
25 | |
---|
26 | @subsection Priority |
---|
27 | |
---|
28 | In the RTEMS implementation of the POSIX API, the priorities range from |
---|
29 | the low priority of @code{sched_get_priority_min()} to the highest priority of |
---|
30 | @code{sched_get_priority_max()}. Numerically higher values represent higher |
---|
31 | priorities. |
---|
32 | |
---|
33 | @subsection Scheduling Policies |
---|
34 | |
---|
35 | The following scheduling policies are available: |
---|
36 | |
---|
37 | @table @b |
---|
38 | @item SCHED_FIFO |
---|
39 | Priority-based, preemptive scheduling with no timeslicing. This is equivalent |
---|
40 | to what is called "manual round-robin" scheduling. |
---|
41 | |
---|
42 | @item SCHED_RR |
---|
43 | Priority-based, preemptive scheduling with timeslicing. Time quantums are |
---|
44 | maintained on a per-thread basis and are not reset at each context switch. |
---|
45 | Thus, a thread which is preempted and subsequently resumes execution will |
---|
46 | attempt to complete the unused portion of its time quantum. |
---|
47 | |
---|
48 | @item SCHED_OTHER |
---|
49 | Priority-based, preemptive scheduling with timeslicing. Time quantums are |
---|
50 | maintained on a per-thread basis and are reset at each context switch. |
---|
51 | |
---|
52 | @item SCHED_SPORADIC |
---|
53 | Priority-based, preemptive scheduling utilizing three additional parameters: |
---|
54 | budget, replenishment period, and low priority. Under this policy, the |
---|
55 | thread is allowed to execute for "budget" amount of time before its priority |
---|
56 | is lowered to "low priority". At the end of each replenishment period, |
---|
57 | the thread resumes its initial priority and has its budget replenished. |
---|
58 | |
---|
59 | @end table |
---|
60 | |
---|
61 | @section Operations |
---|
62 | |
---|
63 | There is currently no text in this section. |
---|
64 | |
---|
65 | @section Directives |
---|
66 | |
---|
67 | This section details the scheduler manager's directives. |
---|
68 | A subsection is dedicated to each of this manager's directives |
---|
69 | and describes the calling sequence, related constants, usage, |
---|
70 | and status codes. |
---|
71 | |
---|
72 | @c |
---|
73 | @c |
---|
74 | @c |
---|
75 | @page |
---|
76 | @subsection sched_get_priority_min - Get Minimum Priority Value |
---|
77 | |
---|
78 | @findex sched_get_priority_min |
---|
79 | @cindex get minimum priority value |
---|
80 | |
---|
81 | @subheading CALLING SEQUENCE: |
---|
82 | |
---|
83 | @example |
---|
84 | #include <sched.h> |
---|
85 | |
---|
86 | int sched_get_priority_min( |
---|
87 | int policy |
---|
88 | ); |
---|
89 | @end example |
---|
90 | |
---|
91 | @subheading STATUS CODES: |
---|
92 | |
---|
93 | On error, this routine returns -1 and sets errno to one of the following: |
---|
94 | |
---|
95 | @table @b |
---|
96 | @item EINVAL |
---|
97 | The indicated policy is invalid. |
---|
98 | |
---|
99 | @end table |
---|
100 | |
---|
101 | @subheading DESCRIPTION: |
---|
102 | |
---|
103 | This routine return the minimum (numerically and logically lowest) priority |
---|
104 | for the specified @code{policy}. |
---|
105 | |
---|
106 | @subheading NOTES: |
---|
107 | |
---|
108 | NONE |
---|
109 | |
---|
110 | @c |
---|
111 | @c |
---|
112 | @c |
---|
113 | @page |
---|
114 | @subsection sched_get_priority_max - Get Maximum Priority Value |
---|
115 | |
---|
116 | @findex sched_get_priority_max |
---|
117 | @cindex get maximum priority value |
---|
118 | |
---|
119 | @subheading CALLING SEQUENCE: |
---|
120 | |
---|
121 | @example |
---|
122 | #include <sched.h> |
---|
123 | |
---|
124 | int sched_get_priority_max( |
---|
125 | int policy |
---|
126 | ); |
---|
127 | @end example |
---|
128 | |
---|
129 | @subheading STATUS CODES: |
---|
130 | |
---|
131 | On error, this routine returns -1 and sets errno to one of the following: |
---|
132 | |
---|
133 | @table @b |
---|
134 | @item EINVAL |
---|
135 | The indicated policy is invalid. |
---|
136 | |
---|
137 | @end table |
---|
138 | |
---|
139 | @subheading DESCRIPTION: |
---|
140 | |
---|
141 | This routine return the maximum (numerically and logically highest) priority |
---|
142 | for the specified @code{policy}. |
---|
143 | |
---|
144 | @subheading NOTES: |
---|
145 | |
---|
146 | NONE |
---|
147 | |
---|
148 | @c |
---|
149 | @c |
---|
150 | @c |
---|
151 | @page |
---|
152 | @subsection sched_rr_get_interval - Get Timeslicing Quantum |
---|
153 | |
---|
154 | @findex sched_rr_get_interval |
---|
155 | @cindex get timeslicing quantum |
---|
156 | |
---|
157 | @subheading CALLING SEQUENCE: |
---|
158 | |
---|
159 | @example |
---|
160 | #include <sched.h> |
---|
161 | |
---|
162 | int sched_rr_get_interval( |
---|
163 | pid_t pid, |
---|
164 | struct timespec *interval |
---|
165 | ); |
---|
166 | @end example |
---|
167 | |
---|
168 | @subheading STATUS CODES: |
---|
169 | |
---|
170 | On error, this routine returns -1 and sets errno to one of the following: |
---|
171 | |
---|
172 | @table @b |
---|
173 | @item ESRCH |
---|
174 | The indicated process id is invalid. |
---|
175 | |
---|
176 | @item EINVAL |
---|
177 | The specified interval pointer parameter is invalid. |
---|
178 | |
---|
179 | @end table |
---|
180 | |
---|
181 | @subheading DESCRIPTION: |
---|
182 | |
---|
183 | This routine returns the length of the timeslice quantum in the |
---|
184 | @code{interval} parameter for the specified @code{pid}. |
---|
185 | |
---|
186 | @subheading NOTES: |
---|
187 | |
---|
188 | The @code{pid} argument should be 0 to indicate the calling process. |
---|
189 | |
---|
190 | @c |
---|
191 | @c |
---|
192 | @c |
---|
193 | @page |
---|
194 | @subsection sched_yield - Yield the Processor |
---|
195 | |
---|
196 | @findex sched_yield |
---|
197 | @cindex yield the processor |
---|
198 | |
---|
199 | @subheading CALLING SEQUENCE: |
---|
200 | |
---|
201 | @example |
---|
202 | #include <sched.h> |
---|
203 | |
---|
204 | int sched_yield( void ); |
---|
205 | @end example |
---|
206 | |
---|
207 | @subheading STATUS CODES: |
---|
208 | |
---|
209 | This routine always returns zero to indicate success. |
---|
210 | |
---|
211 | @subheading DESCRIPTION: |
---|
212 | |
---|
213 | This call forces the calling thread to yield the processor to another |
---|
214 | thread. Normally this is used to implement voluntary round-robin |
---|
215 | task scheduling. |
---|
216 | |
---|
217 | @subheading NOTES: |
---|
218 | |
---|
219 | NONE |
---|