[ae68ff0] | 1 | @c |
---|
[0660b4f8] | 2 | @c COPYRIGHT (c) 1988-1999. |
---|
[7479042] | 3 | @c On-Line Applications Research Corporation (OAR). |
---|
| 4 | @c All rights reserved. |
---|
[ae68ff0] | 5 | @c |
---|
[7479042] | 6 | @c $Id$ |
---|
[139b2e4a] | 7 | @c |
---|
[ae68ff0] | 8 | |
---|
| 9 | @chapter Scheduler Manager |
---|
[c4dddee] | 10 | |
---|
[ae68ff0] | 11 | @section Introduction |
---|
| 12 | |
---|
| 13 | The scheduler manager ... |
---|
| 14 | |
---|
| 15 | The directives provided by the scheduler manager are: |
---|
| 16 | |
---|
| 17 | @itemize @bullet |
---|
[e2c8e2c] | 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 |
---|
[ae68ff0] | 22 | @end itemize |
---|
| 23 | |
---|
| 24 | @section Background |
---|
[c4dddee] | 25 | |
---|
[ae68ff0] | 26 | @subsection Priority |
---|
| 27 | |
---|
| 28 | In the RTEMS implementation of the POSIX API, the priorities range from |
---|
[e2c8e2c] | 29 | the low priority of @code{sched_get_priority_min()} to the highest priority of |
---|
[7479042] | 30 | @code{sched_get_priority_max()}. Numerically higher values represent higher |
---|
[ae68ff0] | 31 | priorities. |
---|
| 32 | |
---|
| 33 | @subsection Scheduling Policies |
---|
| 34 | |
---|
| 35 | The following scheduling policies are available: |
---|
| 36 | |
---|
| 37 | @table @b |
---|
| 38 | @item SCHED_FIFO |
---|
[7479042] | 39 | Priority-based, preemptive scheduling with no timeslicing. This is equivalent |
---|
[ae68ff0] | 40 | to what is called "manual round-robin" scheduling. |
---|
| 41 | |
---|
| 42 | @item SCHED_RR |
---|
[7479042] | 43 | Priority-based, preemptive scheduling with timeslicing. Time quantums are |
---|
[ae68ff0] | 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 |
---|
[7479042] | 49 | Priority-based, preemptive scheduling with timeslicing. Time quantums are |
---|
[ae68ff0] | 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: |
---|
[7479042] | 54 | budget, replenishment period, and low priority. Under this policy, the |
---|
[ae68ff0] | 55 | thread is allowed to execute for "budget" amount of time before its priority |
---|
[7479042] | 56 | is lowered to "low priority". At the end of each replenishment period, |
---|
[ae68ff0] | 57 | the thread resumes its initial priority and has its budget replenished. |
---|
| 58 | |
---|
| 59 | @end table |
---|
| 60 | |
---|
| 61 | @section Operations |
---|
| 62 | |
---|
[c4dddee] | 63 | There is currently no text in this section. |
---|
| 64 | |
---|
[ae68ff0] | 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 | |
---|
[7479042] | 72 | @c |
---|
| 73 | @c |
---|
| 74 | @c |
---|
[ae68ff0] | 75 | @page |
---|
[e2c8e2c] | 76 | @subsection sched_get_priority_min - Get Minimum Priority Value |
---|
[ae68ff0] | 77 | |
---|
[7479042] | 78 | @findex sched_get_priority_min |
---|
| 79 | @cindex get minimum priority value |
---|
| 80 | |
---|
[ae68ff0] | 81 | @subheading CALLING SEQUENCE: |
---|
| 82 | |
---|
| 83 | @example |
---|
| 84 | #include <sched.h> |
---|
| 85 | |
---|
| 86 | int sched_get_priority_min( |
---|
[3db81880] | 87 | int policy |
---|
[ae68ff0] | 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. |
---|
[7479042] | 98 | |
---|
[ae68ff0] | 99 | @end table |
---|
| 100 | |
---|
| 101 | @subheading DESCRIPTION: |
---|
| 102 | |
---|
[e2c8e2c] | 103 | This routine return the minimum (numerically and logically lowest) priority |
---|
| 104 | for the specified @code{policy}. |
---|
| 105 | |
---|
[ae68ff0] | 106 | @subheading NOTES: |
---|
| 107 | |
---|
[e2c8e2c] | 108 | NONE |
---|
| 109 | |
---|
[7479042] | 110 | @c |
---|
| 111 | @c |
---|
| 112 | @c |
---|
[ae68ff0] | 113 | @page |
---|
[e2c8e2c] | 114 | @subsection sched_get_priority_max - Get Maximum Priority Value |
---|
[ae68ff0] | 115 | |
---|
[7479042] | 116 | @findex sched_get_priority_max |
---|
| 117 | @cindex get maximum priority value |
---|
| 118 | |
---|
[ae68ff0] | 119 | @subheading CALLING SEQUENCE: |
---|
| 120 | |
---|
| 121 | @example |
---|
| 122 | #include <sched.h> |
---|
| 123 | |
---|
| 124 | int sched_get_priority_max( |
---|
[3db81880] | 125 | int policy |
---|
[ae68ff0] | 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. |
---|
[7479042] | 136 | |
---|
[ae68ff0] | 137 | @end table |
---|
| 138 | |
---|
| 139 | @subheading DESCRIPTION: |
---|
| 140 | |
---|
[e2c8e2c] | 141 | This routine return the maximum (numerically and logically highest) priority |
---|
| 142 | for the specified @code{policy}. |
---|
| 143 | |
---|
[ae68ff0] | 144 | @subheading NOTES: |
---|
| 145 | |
---|
[e2c8e2c] | 146 | NONE |
---|
| 147 | |
---|
[7479042] | 148 | @c |
---|
| 149 | @c |
---|
| 150 | @c |
---|
[ae68ff0] | 151 | @page |
---|
[e2c8e2c] | 152 | @subsection sched_rr_get_interval - Get Timeslicing Quantum |
---|
[ae68ff0] | 153 | |
---|
[7479042] | 154 | @findex sched_rr_get_interval |
---|
| 155 | @cindex get timeslicing quantum |
---|
| 156 | |
---|
[ae68ff0] | 157 | @subheading CALLING SEQUENCE: |
---|
| 158 | |
---|
| 159 | @example |
---|
| 160 | #include <sched.h> |
---|
| 161 | |
---|
| 162 | int sched_rr_get_interval( |
---|
[3db81880] | 163 | pid_t pid, |
---|
| 164 | struct timespec *interval |
---|
[ae68ff0] | 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 |
---|
[7479042] | 174 | The indicated process id is invalid. |
---|
| 175 | |
---|
[ae68ff0] | 176 | @item EINVAL |
---|
[7479042] | 177 | The specified interval pointer parameter is invalid. |
---|
[ae68ff0] | 178 | |
---|
| 179 | @end table |
---|
| 180 | |
---|
| 181 | @subheading DESCRIPTION: |
---|
| 182 | |
---|
[7479042] | 183 | This routine returns the length of the timeslice quantum in the |
---|
[e2c8e2c] | 184 | @code{interval} parameter for the specified @code{pid}. |
---|
| 185 | |
---|
[ae68ff0] | 186 | @subheading NOTES: |
---|
| 187 | |
---|
[e2c8e2c] | 188 | The @code{pid} argument should be 0 to indicate the calling process. |
---|
| 189 | |
---|
[7479042] | 190 | @c |
---|
| 191 | @c |
---|
| 192 | @c |
---|
[ae68ff0] | 193 | @page |
---|
[e2c8e2c] | 194 | @subsection sched_yield - Yield the Processor |
---|
[ae68ff0] | 195 | |
---|
[7479042] | 196 | @findex sched_yield |
---|
| 197 | @cindex yield the processor |
---|
| 198 | |
---|
[ae68ff0] | 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 | |
---|
[e2c8e2c] | 213 | This call forces the calling thread to yield the processor to another |
---|
[7479042] | 214 | thread. Normally this is used to implement voluntary round-robin |
---|
[e2c8e2c] | 215 | task scheduling. |
---|
| 216 | |
---|
[ae68ff0] | 217 | @subheading NOTES: |
---|
| 218 | |
---|
[e2c8e2c] | 219 | NONE |
---|