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

5
Last change on this file since e52906b was e52906b, checked in by Sebastian Huber <sebastian.huber@…>, on 01/09/19 at 15:14:06

Simplify SPDX-License-Identifier comment

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