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