source: rtems-docs/posix_users/scheduler.rst @ 3a71759

4.115
Last change on this file since 3a71759 was 1264a8f, checked in by Amar Takhar <amar@…>, on 01/17/16 at 05:55:21

Split document into seperate files by section.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1Scheduler Manager
2#################
3
4Introduction
5============
6
7The scheduler manager ...
8
9The 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
19Background
20==========
21
22Priority
23--------
24
25In the RTEMS implementation of the POSIX API, the priorities range from
26the low priority of ``sched_get_priority_min()`` to the highest priority of``sched_get_priority_max()``. Numerically higher values represent higher
27priorities.
28
29Scheduling Policies
30-------------------
31
32The 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
55Operations
56==========
57
58There is currently no text in this section.
59
60Directives
61==========
62
63This section details the scheduler manager’s directives.
64A subsection is dedicated to each of this manager’s directives
65and describes the calling sequence, related constants, usage,
66and status codes.
67
68sched_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
84On 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
91This routine return the minimum (numerically and logically lowest) priority
92for the specified ``policy``.
93
94**NOTES:**
95
96NONE
97
98sched_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
114On 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
121This routine return the maximum (numerically and logically highest) priority
122for the specified ``policy``.
123
124**NOTES:**
125
126NONE
127
128sched_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
145On 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
155This routine returns the length of the timeslice quantum in the``interval`` parameter for the specified ``pid``.
156
157**NOTES:**
158
159The ``pid`` argument should be 0 to indicate the calling process.
160
161sched_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
175This routine always returns zero to indicate success.
176
177**DESCRIPTION:**
178
179This call forces the calling thread to yield the processor to another
180thread. Normally this is used to implement voluntary round-robin
181task scheduling.
182
183**NOTES:**
184
185NONE
186
187.. COMMENT: COPYRIGHT (c) 1988-2002.
188
189.. COMMENT: On-Line Applications Research Corporation (OAR).
190
191.. COMMENT: All rights reserved.
192
Note: See TracBrowser for help on using the repository browser.