[6c914e9] | 1 | @c |
---|
| 2 | @c COPYRIGHT (c) 1988-1998. |
---|
| 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 |
---|
[4ebb4862] | 10 | |
---|
[6c914e9] | 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} - |
---|
| 19 | @item @code{sched_get_priority_max} - |
---|
| 20 | @item @code{sched_rr_get_interval} - |
---|
| 21 | @item @code{sched_yield} - |
---|
| 22 | @end itemize |
---|
| 23 | |
---|
| 24 | @section Background |
---|
[4ebb4862] | 25 | |
---|
[6c914e9] | 26 | @subsection Priority |
---|
| 27 | |
---|
| 28 | In the RTEMS implementation of the POSIX API, the priorities range from |
---|
| 29 | the low priority of sched_get_priority_min() to the highest priority of |
---|
| 30 | 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 | |
---|
[241e4c7c] | 63 | There is currently no text in this section. |
---|
| 64 | |
---|
[6c914e9] | 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 | @page |
---|
| 73 | @subsection sched_get_priority_min |
---|
| 74 | |
---|
| 75 | @subheading CALLING SEQUENCE: |
---|
| 76 | |
---|
| 77 | @example |
---|
| 78 | #include <sched.h> |
---|
| 79 | |
---|
| 80 | int sched_get_priority_min( |
---|
| 81 | int policy |
---|
| 82 | ); |
---|
| 83 | @end example |
---|
| 84 | |
---|
| 85 | @subheading STATUS CODES: |
---|
| 86 | |
---|
| 87 | On error, this routine returns -1 and sets errno to one of the following: |
---|
| 88 | |
---|
| 89 | @table @b |
---|
| 90 | @item EINVAL |
---|
| 91 | The indicated policy is invalid. |
---|
| 92 | |
---|
| 93 | @end table |
---|
| 94 | |
---|
| 95 | @subheading DESCRIPTION: |
---|
| 96 | |
---|
| 97 | @subheading NOTES: |
---|
| 98 | |
---|
| 99 | @page |
---|
| 100 | @subsection sched_get_priority_max |
---|
| 101 | |
---|
| 102 | @subheading CALLING SEQUENCE: |
---|
| 103 | |
---|
| 104 | @example |
---|
| 105 | #include <sched.h> |
---|
| 106 | |
---|
| 107 | int sched_get_priority_max( |
---|
| 108 | int policy |
---|
| 109 | ); |
---|
| 110 | @end example |
---|
| 111 | |
---|
| 112 | @subheading STATUS CODES: |
---|
| 113 | |
---|
| 114 | On error, this routine returns -1 and sets errno to one of the following: |
---|
| 115 | |
---|
| 116 | @table @b |
---|
| 117 | @item EINVAL |
---|
| 118 | The indicated policy is invalid. |
---|
| 119 | |
---|
| 120 | @end table |
---|
| 121 | |
---|
| 122 | @subheading DESCRIPTION: |
---|
| 123 | |
---|
| 124 | @subheading NOTES: |
---|
| 125 | |
---|
| 126 | @page |
---|
| 127 | @subsection sched_rr_get_interval |
---|
| 128 | |
---|
| 129 | @subheading CALLING SEQUENCE: |
---|
| 130 | |
---|
| 131 | @example |
---|
| 132 | #include <sched.h> |
---|
| 133 | |
---|
| 134 | int sched_rr_get_interval( |
---|
| 135 | pid_t pid, |
---|
| 136 | struct timespec *interval |
---|
| 137 | ); |
---|
| 138 | @end example |
---|
| 139 | |
---|
| 140 | @subheading STATUS CODES: |
---|
| 141 | |
---|
| 142 | On error, this routine returns -1 and sets errno to one of the following: |
---|
| 143 | |
---|
| 144 | @table @b |
---|
| 145 | @item ESRCH |
---|
| 146 | The indicated process id is invalid. |
---|
| 147 | |
---|
| 148 | @item EINVAL |
---|
| 149 | The specified interval pointer parameter is invalid. |
---|
| 150 | |
---|
| 151 | @end table |
---|
| 152 | |
---|
| 153 | @subheading DESCRIPTION: |
---|
| 154 | |
---|
| 155 | @subheading NOTES: |
---|
| 156 | |
---|
| 157 | @page |
---|
| 158 | @subsection sched_yield |
---|
| 159 | |
---|
| 160 | @subheading CALLING SEQUENCE: |
---|
| 161 | |
---|
| 162 | @example |
---|
| 163 | #include <sched.h> |
---|
| 164 | |
---|
| 165 | int sched_yield( void ); |
---|
| 166 | @end example |
---|
| 167 | |
---|
| 168 | @subheading STATUS CODES: |
---|
| 169 | |
---|
| 170 | This routine always returns zero to indicate success. |
---|
| 171 | |
---|
| 172 | @subheading DESCRIPTION: |
---|
| 173 | |
---|
| 174 | @subheading NOTES: |
---|
| 175 | |
---|