source: rtems-docs/posix-users/scheduler.rst @ 42d50d7

5
Last change on this file since 42d50d7 was 72a62ad, checked in by Chris Johns <chrisj@…>, on 11/03/16 at 05:58:08

Rename all manuals with an _ to have a -. It helps released naming of files.

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