source: rtems-docs/c-user/scheduling_concepts.rst @ 4de0da1

5
Last change on this file since 4de0da1 was 16f33fd, checked in by Sebastian Huber <sebastian.huber@…>, on 12/07/18 at 13:56:49

c-user: rtems_scheduler_get_maximum_priority()

Close #3636.

  • Property mode set to 100644
File size: 31.4 KB
Line 
1.. comment SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. COMMENT: COPYRIGHT (c) 1988-2008.
4.. COMMENT: On-Line Applications Research Corporation (OAR).
5.. COMMENT: All rights reserved.
6
7.. index:: scheduling
8.. index:: task scheduling
9
10.. _SchedulingConcepts:
11
12Scheduling Concepts
13*******************
14
15Introduction
16============
17
18The concept of scheduling in real-time systems dictates the ability to provide
19immediate response to specific external events, particularly the necessity of
20scheduling tasks to run within a specified time limit after the occurrence of
21an event.  For example, software embedded in life-support systems used to
22monitor hospital patients must take instant action if a change in the patient's
23status is detected.
24
25The component of RTEMS responsible for providing this capability is
26appropriately called the scheduler.  The scheduler's sole purpose is to
27allocate the all important resource of processor time to the various tasks
28competing for attention.
29
30The directives provided by the scheduler manager are:
31
32- rtems_scheduler_ident_ - Get ID of a scheduler
33
34- rtems_scheduler_ident_by_processor_ - Get ID of a scheduler by processor
35
36- rtems_scheduler_ident_by_processor_set_ - Get ID of a scheduler by processor set
37
38- rtems_scheduler_get_maximum_priority_ - Get maximum task priority of a scheduler
39
40- rtems_scheduler_get_processor_set_ - Get processor set of a scheduler
41
42- rtems_scheduler_add_processor_ - Add processor to a scheduler
43
44- rtems_scheduler_remove_processor_ - Remove processor from a scheduler
45
46.. index:: scheduling algorithms
47
48Scheduling Algorithms
49---------------------
50
51RTEMS provides a plugin framework which allows it to support multiple
52scheduling algorithms. RTEMS includes multiple scheduling algorithms and the
53user can select which of these they wish to use in their application at
54link-time.  In addition, the user can implement their own scheduling algorithm
55and configure RTEMS to use it.
56
57Supporting multiple scheduling algorithms gives the end user the option to
58select the algorithm which is most appropriate to their use case. Most
59real-time operating systems schedule tasks using a priority based algorithm,
60possibly with preemption control.  The classic RTEMS scheduling algorithm which
61was the only algorithm available in RTEMS 4.10 and earlier, is a fixed-priority
62scheduling algorithm.  This scheduling algoritm is suitable for uniprocessor
63(e.g. non-SMP) systems and is known as the *Deterministic Priority
64Scheduler*.  Unless the user configures another scheduling algorithm, RTEMS
65will use this on uniprocessor systems.
66
67.. index:: priority scheduling
68
69Priority Scheduling
70-------------------
71
72When using priority based scheduling, RTEMS allocates the processor using a
73priority-based, preemptive algorithm augmented to provide round-robin
74characteristics within individual priority groups.  The goal of this algorithm
75is to guarantee that the task which is executing on the processor at any point
76in time is the one with the highest priority among all tasks in the ready
77state.
78
79When a task is added to the ready chain, it is placed behind all other tasks of
80the same priority.  This rule provides a round-robin within priority group
81scheduling characteristic.  This means that in a group of equal priority tasks,
82tasks will execute in the order they become ready or FIFO order.  Even though
83there are ways to manipulate and adjust task priorities, the most important
84rule to remember is:
85
86.. note::
87
88  Priority based scheduling algorithms will always select the highest priority
89  task that is ready to run when allocating the processor to a task.
90
91Priority scheduling is the most commonly used scheduling algorithm.  It should
92be used by applications in which multiple tasks contend for CPU time or other
93resources and there is a need to ensure certain tasks are given priority over
94other tasks.
95
96There are a few common methods of accomplishing the mechanics of this
97algorithm.  These ways involve a list or chain of tasks in the ready state.
98
99- The least efficient method is to randomly place tasks in the ready chain
100  forcing the scheduler to scan the entire chain to determine which task
101  receives the processor.
102
103- A more efficient method is to schedule the task by placing it in the proper
104  place on the ready chain based on the designated scheduling criteria at the
105  time it enters the ready state.  Thus, when the processor is free, the first
106  task on the ready chain is allocated the processor.
107
108- Another mechanism is to maintain a list of FIFOs per priority.  When a task
109  is readied, it is placed on the rear of the FIFO for its priority.  This
110  method is often used with a bitmap to assist in locating which FIFOs have
111  ready tasks on them.  This data structure has :math:`O(1)` insert, extract
112  and find highest ready run-time complexities.
113
114- A red-black tree may be used for the ready queue with the priority as the
115  key.  This data structure has :math:`O(log(n))` insert, extract and find
116  highest ready run-time complexities while :math:`n` is the count of tasks in
117  the ready queue.
118
119RTEMS currently includes multiple priority based scheduling algorithms as well
120as other algorithms which incorporate deadline.  Each algorithm is discussed in
121the following sections.
122
123Uniprocessor Schedulers
124=======================
125
126All uniprocessor schedulers included in RTEMS are priority based.  The
127processor is allocated to the highest priority task allowed to run.
128
129.. _SchedulerPriority:
130
131Deterministic Priority Scheduler
132--------------------------------
133
134This is the scheduler implementation which has always been in RTEMS.  After the
1354.10 release series, it was factored into pluggable scheduler selection.  It
136schedules tasks using a priority based algorithm which takes into account
137preemption.  It is implemented using an array of FIFOs with a FIFO per
138priority.  It maintains a bitmap which is used to track which priorities have
139ready tasks.
140
141This algorithm is deterministic (e.g. predictable and fixed) in execution time.
142This comes at the cost of using slightly over three (3) kilobytes of RAM on a
143system configured to support 256 priority levels.
144
145This scheduler is only aware of a single core.
146
147.. _SchedulerPrioritySimple:
148
149Simple Priority Scheduler
150-------------------------
151
152This scheduler implementation has the same behaviour as the Deterministic
153Priority Scheduler but uses only one linked list to manage all ready tasks.
154When a task is readied, a linear search of that linked list is performed to
155determine where to insert the newly readied task.
156
157This algorithm uses much less RAM than the Deterministic Priority Scheduler but
158is *O(n)* where *n* is the number of ready tasks.  In a small system with a
159small number of tasks, this will not be a performance issue.  Reducing RAM
160consumption is often critical in small systems which are incapable of
161supporting a large number of tasks.
162
163This scheduler is only aware of a single core.
164
165.. index:: earliest deadline first scheduling
166
167.. _SchedulerEDF:
168
169Earliest Deadline First Scheduler
170---------------------------------
171
172This is an alternative scheduler in RTEMS for single core applications.  The
173primary EDF advantage is high total CPU utilization (theoretically up to
174100%). It assumes that tasks have priorities equal to deadlines.
175
176This EDF is initially preemptive, however, individual tasks may be declared
177not-preemptive. Deadlines are declared using only Rate Monotonic manager which
178goal is to handle periodic behavior. Period is always equal to deadline. All
179ready tasks reside in a single ready queue implemented using a red-black tree.
180
181This implementation of EDF schedules two different types of task priority types
182while each task may switch between the two types within its execution. If a
183task does have a deadline declared using the Rate Monotonic manager, the task
184is deadline-driven and its priority is equal to deadline.  On the contrary if a
185task does not have any deadline or the deadline is cancelled using the Rate
186Monotonic manager, the task is considered a background task with priority equal
187to that assigned upon initialization in the same manner as for priority
188scheduler. Each background task is of a lower importance than each
189deadline-driven one and is scheduled when no deadline-driven task and no higher
190priority background task is ready to run.
191
192Every deadline-driven scheduling algorithm requires means for tasks to claim a
193deadline.  The Rate Monotonic Manager is responsible for handling periodic
194execution. In RTEMS periods are equal to deadlines, thus if a task announces a
195period, it has to be finished until the end of this period. The call of
196``rtems_rate_monotonic_period`` passes the scheduler the length of oncoming
197deadline. Moreover, the ``rtems_rate_monotonic_cancel`` and
198``rtems_rate_monotonic_delete`` calls clear the deadlines assigned to the task.
199
200.. index:: constant bandwidth server scheduling
201
202.. _SchedulerCBS:
203
204Constant Bandwidth Server Scheduling (CBS)
205------------------------------------------
206
207This is an alternative scheduler in RTEMS for single core applications.  The
208CBS is a budget aware extension of EDF scheduler. The main goal of this
209scheduler is to ensure temporal isolation of tasks meaning that a task's
210execution in terms of meeting deadlines must not be influenced by other tasks
211as if they were run on multiple independent processors.
212
213Each task can be assigned a server (current implementation supports only one
214task per server). The server is characterized by period (deadline) and
215computation time (budget). The ratio budget/period yields bandwidth, which is
216the fraction of CPU to be reserved by the scheduler for each subsequent period.
217
218The CBS is equipped with a set of rules applied to tasks attached to servers
219ensuring that deadline miss because of another task cannot occur.  In case a
220task breaks one of the rules, its priority is pulled to background until the
221end of its period and then restored again. The rules are:
222
223- Task cannot exceed its registered budget,
224
225- Task cannot be unblocked when a ratio between remaining budget and remaining
226  deadline is higher than declared bandwidth.
227
228The CBS provides an extensive API. Unlike EDF, the
229``rtems_rate_monotonic_period`` does not declare a deadline because it is
230carried out using CBS API. This call only announces next period.
231
232SMP Schedulers
233==============
234
235All SMP schedulers included in RTEMS are priority based.  The processors
236managed by a scheduler instance are allocated to the highest priority tasks
237allowed to run.
238
239.. _SchedulerSMPEDF:
240
241Earliest Deadline First SMP Scheduler
242-------------------------------------
243
244This is a job-level fixed-priority scheduler using the Earliest Deadline First
245(EDF) method.  By convention, the maximum priority level is
246:math:`min(INT\_MAX, 2^{62} - 1)` for background tasks.  Tasks without an
247active deadline are background tasks.  In case deadlines are not used, then the
248EDF scheduler behaves exactly like a fixed-priority scheduler.  The tasks with
249an active deadline have a higher priority than the background tasks.  This
250scheduler supports :ref:`task processor affinities <rtems_task_set_affinity>`
251of one-to-one and one-to-all, e.g.  a task can execute on exactly one processor
252or all processors managed by the scheduler instance.  The processor affinity
253set of a task must contain all online processors to select the one-to-all
254affinity.  This is to avoid pathological cases if processors are added/removed
255to/from the scheduler instance at run-time.  In case the processor affinity set
256contains not all online processors, then a one-to-one affinity will be used
257selecting the processor with the largest index within the set of processors
258currently owned by the scheduler instance.  This scheduler algorithm supports
259:ref:`thread pinning <ThreadPinning>`.  The ready queues use a red-black tree
260with the task priority as the key.
261
262This scheduler algorithm is the default scheduler in SMP configurations if more
263than one processor is configured (:ref:`CONFIGURE_MAXIMUM_PROCESSORS
264<CONFIGURE_MAXIMUM_PROCESSORS>`).
265
266.. _SchedulerSMPPriority:
267
268Deterministic Priority SMP Scheduler
269------------------------------------
270
271A fixed-priority scheduler which uses a table of chains with one chain per
272priority level for the ready tasks.  The maximum priority level is
273configurable.  By default, the maximum priority level is 255 (256 priority
274levels).
275
276.. _SchedulerSMPPrioritySimple:
277
278Simple Priority SMP Scheduler
279-----------------------------
280
281A fixed-priority scheduler which uses a sorted chain for the ready tasks.  By
282convention, the maximum priority level is 255.  The implementation limit is
283actually :math:`2^{63} - 1`.
284
285.. _SchedulerSMPPriorityAffinity:
286
287Arbitrary Processor Affinity Priority SMP Scheduler
288---------------------------------------------------
289
290A fixed-priority scheduler which uses a table of chains with one chain per
291priority level for the ready tasks.  The maximum priority level is
292configurable.  By default, the maximum priority level is 255 (256 priority
293levels).  This scheduler supports arbitrary task processor affinities.  The
294worst-case run-time complexity of some scheduler operations exceeds
295:math:`O(n)` while :math:`n` is the count of ready tasks.
296
297.. index:: scheduling mechanisms
298
299Scheduling Modification Mechanisms
300==================================
301
302RTEMS provides four mechanisms which allow the user to alter the task
303scheduling decisions:
304
305- user-selectable task priority level
306
307- task preemption control
308
309- task timeslicing control
310
311- manual round-robin selection
312
313Each of these methods provides a powerful capability to customize sets of tasks
314to satisfy the unique and particular requirements encountered in custom
315real-time applications.  Although each mechanism operates independently, there
316is a precedence relationship which governs the effects of scheduling
317modifications.  The evaluation order for scheduling characteristics is always
318priority, preemption mode, and timeslicing.  When reading the descriptions of
319timeslicing and manual round-robin it is important to keep in mind that
320preemption (if enabled) of a task by higher priority tasks will occur as
321required, overriding the other factors presented in the description.
322
323.. index:: task priority
324
325Task Priority and Scheduling
326----------------------------
327
328The most significant task scheduling modification mechanism is the ability for
329the user to assign a priority level to each individual task when it is created
330and to alter a task's priority at run-time.  The maximum priority level depends
331on the configured scheduler.  A lower priority level means higher priority
332(higher importance).  The maximum priority level of the default uniprocessor
333scheduler is 255.
334
335.. index:: preemption
336
337Preemption
338----------
339
340Another way the user can alter the basic scheduling algorithm is by
341manipulating the preemption mode flag (``RTEMS_PREEMPT_MASK``) of individual
342tasks.  If preemption is disabled for a task (``RTEMS_NO_PREEMPT``), then the
343task will not relinquish control of the processor until it terminates, blocks,
344or re-enables preemption.  Even tasks which become ready to run and possess
345higher priority levels will not be allowed to execute.  Note that the
346preemption setting has no effect on the manner in which a task is scheduled.
347It only applies once a task has control of the processor.
348
349.. index:: timeslicing
350.. index:: round robin scheduling
351
352Timeslicing
353-----------
354
355Timeslicing or round-robin scheduling is an additional method which can be used
356to alter the basic scheduling algorithm.  Like preemption, timeslicing is
357specified on a task by task basis using the timeslicing mode flag
358(``RTEMS_TIMESLICE_MASK``).  If timeslicing is enabled for a task
359(``RTEMS_TIMESLICE``), then RTEMS will limit the amount of time the task can
360execute before the processor is allocated to another task.  Each tick of the
361real-time clock reduces the currently running task's timeslice.  When the
362execution time equals the timeslice, RTEMS will dispatch another task of the
363same priority to execute.  If there are no other tasks of the same priority
364ready to execute, then the current task is allocated an additional timeslice
365and continues to run.  Remember that a higher priority task will preempt the
366task (unless preemption is disabled) as soon as it is ready to run, even if the
367task has not used up its entire timeslice.
368
369.. index:: manual round robin
370
371Manual Round-Robin
372------------------
373
374The final mechanism for altering the RTEMS scheduling algorithm is called
375manual round-robin.  Manual round-robin is invoked by using
376the ``rtems_task_wake_after`` directive with a time interval of
377``RTEMS_YIELD_PROCESSOR``.  This allows a task to give up the processor and be
378immediately returned to the ready chain at the end of its priority group.  If
379no other tasks of the same priority are ready to run, then the task does not
380lose control of the processor.
381
382.. index:: dispatching
383
384Dispatching Tasks
385=================
386
387The dispatcher is the RTEMS component responsible for allocating the processor
388to a ready task.  In order to allocate the processor to one task, it must be
389deallocated or retrieved from the task currently using it.  This involves a
390concept called a context switch.  To perform a context switch, the dispatcher
391saves the context of the current task and restores the context of the task
392which has been allocated to the processor.  Saving and restoring a task's
393context is the storing/loading of all the essential information about a task to
394enable it to continue execution without any effects of the interruption.  For
395example, the contents of a task's register set must be the same when it is
396given the processor as they were when it was taken away.  All of the
397information that must be saved or restored for a context switch is located
398either in the TCB or on the task's stacks.
399
400Tasks that utilize a numeric coprocessor and are created with the
401``RTEMS_FLOATING_POINT`` attribute require additional operations during a
402context switch.  These additional operations are necessary to save and restore
403the floating point context of ``RTEMS_FLOATING_POINT`` tasks.  To avoid
404unnecessary save and restore operations, the state of the numeric coprocessor
405is only saved when a ``RTEMS_FLOATING_POINT`` task is dispatched and that task
406was not the last task to utilize the coprocessor.
407
408.. index:: task state transitions
409
410Task State Transitions
411======================
412
413Tasks in an RTEMS system must always be in one of the five allowable task
414states.  These states are: executing, ready, blocked, dormant, and
415non-existent.
416
417A task occupies the non-existent state before a ``rtems_task_create`` has been
418issued on its behalf.  A task enters the non-existent state from any other
419state in the system when it is deleted with the ``rtems_task_delete``
420directive.  While a task occupies this state it does not have a TCB or a task
421ID assigned to it; therefore, no other tasks in the system may reference this
422task.
423
424When a task is created via the ``rtems_task_create`` directive it enters the
425dormant state.  This state is not entered through any other means.  Although
426the task exists in the system, it cannot actively compete for system resources.
427It will remain in the dormant state until it is started via the
428``rtems_task_start`` directive, at which time it enters the ready state.  The
429task is now permitted to be scheduled for the processor and to compete for
430other system resources.
431
432.. figure:: ../images/c_user/states.png
433         :width: 70%
434         :align: center
435         :alt: Task State Transitions
436
437A task occupies the blocked state whenever it is unable to be scheduled to run.
438A running task may block itself or be blocked by other tasks in the system.
439The running task blocks itself through voluntary operations that cause the task
440to wait.  The only way a task can block a task other than itself is with the
441``rtems_task_suspend`` directive.  A task enters the blocked state due to any
442of the following conditions:
443
444- A task issues a ``rtems_task_suspend`` directive which blocks either itself
445  or another task in the system.
446
447- The running task issues a ``rtems_barrier_wait`` directive.
448
449- The running task issues a ``rtems_message_queue_receive`` directive with the
450  wait option and the message queue is empty.
451
452- The running task issues an ``rtems_event_receive`` directive with the wait
453  option and the currently pending events do not satisfy the request.
454
455- The running task issues a ``rtems_semaphore_obtain`` directive with the wait
456  option and the requested semaphore is unavailable.
457
458- The running task issues a ``rtems_task_wake_after`` directive which blocks
459  the task for the given time interval.  If the time interval specified is
460  zero, the task yields the processor and remains in the ready state.
461
462- The running task issues a ``rtems_task_wake_when`` directive which blocks the
463  task until the requested date and time arrives.
464
465- The running task issues a ``rtems_rate_monotonic_period`` directive and must
466  wait for the specified rate monotonic period to conclude.
467
468- The running task issues a ``rtems_region_get_segment`` directive with the
469  wait option and there is not an available segment large enough to satisfy the
470  task's request.
471
472A blocked task may also be suspended.  Therefore, both the suspension and the
473blocking condition must be removed before the task becomes ready to run again.
474
475A task occupies the ready state when it is able to be scheduled to run, but
476currently does not have control of the processor.  Tasks of the same or higher
477priority will yield the processor by either becoming blocked, completing their
478timeslice, or being deleted.  All tasks with the same priority will execute in
479FIFO order.  A task enters the ready state due to any of the following
480conditions:
481
482- A running task issues a ``rtems_task_resume`` directive for a task that is
483  suspended and the task is not blocked waiting on any resource.
484
485- A running task issues a ``rtems_message_queue_send``,
486  ``rtems_message_queue_broadcast``, or a ``rtems_message_queue_urgent``
487  directive which posts a message to the queue on which the blocked task is
488  waiting.
489
490- A running task issues an ``rtems_event_send`` directive which sends an event
491  condition to a task which is blocked waiting on that event condition.
492
493- A running task issues a ``rtems_semaphore_release`` directive which releases
494  the semaphore on which the blocked task is waiting.
495
496- A timeout interval expires for a task which was blocked by a call to the
497  ``rtems_task_wake_after`` directive.
498
499- A timeout period expires for a task which blocked by a call to the
500  ``rtems_task_wake_when`` directive.
501
502- A running task issues a ``rtems_region_return_segment`` directive which
503  releases a segment to the region on which the blocked task is waiting and a
504  resulting segment is large enough to satisfy the task's request.
505
506- A rate monotonic period expires for a task which blocked by a call to the
507  ``rtems_rate_monotonic_period`` directive.
508
509- A timeout interval expires for a task which was blocked waiting on a message,
510  event, semaphore, or segment with a timeout specified.
511
512- A running task issues a directive which deletes a message queue, a semaphore,
513  or a region on which the blocked task is waiting.
514
515- A running task issues a ``rtems_task_restart`` directive for the blocked
516  task.
517
518- The running task, with its preemption mode enabled, may be made ready by
519  issuing any of the directives that may unblock a task with a higher priority.
520  This directive may be issued from the running task itself or from an ISR.  A
521  ready task occupies the executing state when it has control of the CPU.  A
522  task enters the executing state due to any of the following conditions:
523
524- The task is the highest priority ready task in the system.
525
526- The running task blocks and the task is next in the scheduling queue.  The
527  task may be of equal priority as in round-robin scheduling or the task may
528  possess the highest priority of the remaining ready tasks.
529
530- The running task may reenable its preemption mode and a task exists in the
531  ready queue that has a higher priority than the running task.
532
533- The running task lowers its own priority and another task is of higher
534  priority as a result.
535
536- The running task raises the priority of a task above its own and the running
537  task is in preemption mode.
538
539Directives
540==========
541
542This section details the scheduler manager.  A subsection is dedicated to each
543of these services and describes the calling sequence, related constants, usage,
544and status codes.
545
546.. raw:: latex
547
548   \clearpage
549
550.. _rtems_scheduler_ident:
551
552SCHEDULER_IDENT - Get ID of a scheduler
553---------------------------------------
554
555CALLING SEQUENCE:
556    .. code-block:: c
557
558        rtems_status_code rtems_scheduler_ident(
559            rtems_name  name,
560            rtems_id   *id
561        );
562
563DIRECTIVE STATUS CODES:
564    .. list-table::
565     :class: rtems-table
566
567     * - ``RTEMS_SUCCESSFUL``
568       - Successful operation.
569     * - ``RTEMS_INVALID_ADDRESS``
570       - The ``id`` parameter is ``NULL``.
571     * - ``RTEMS_INVALID_NAME``
572       - Invalid scheduler name.
573
574DESCRIPTION:
575    Identifies a scheduler by its name.  The scheduler name is determined by
576    the scheduler configuration.  See :ref:`ConfigurationSchedulerTable`
577    and :ref:`CONFIGURE_SCHEDULER_NAME`.
578
579NOTES:
580    None.
581
582.. raw:: latex
583
584   \clearpage
585
586.. _rtems_scheduler_ident_by_processor:
587
588SCHEDULER_IDENT_BY_PROCESSOR - Get ID of a scheduler by processor
589-----------------------------------------------------------------
590
591CALLING SEQUENCE:
592    .. code-block:: c
593
594        rtems_status_code rtems_scheduler_ident_by_processor(
595            uint32_t  cpu_index,
596            rtems_id *id
597        );
598
599DIRECTIVE STATUS CODES:
600    .. list-table::
601     :class: rtems-table
602
603     * - ``RTEMS_SUCCESSFUL``
604       - Successful operation.
605     * - ``RTEMS_INVALID_ADDRESS``
606       - The ``id`` parameter is ``NULL``.
607     * - ``RTEMS_INVALID_NAME``
608       - Invalid processor index.
609     * - ``RTEMS_INCORRECT_STATE``
610       - The processor index is valid, however, this processor is not owned by
611         a scheduler.
612
613DESCRIPTION:
614    Identifies a scheduler by a processor.
615
616NOTES:
617    None.
618
619.. raw:: latex
620
621   \clearpage
622
623.. _rtems_scheduler_ident_by_processor_set:
624
625SCHEDULER_IDENT_BY_PROCESSOR_SET - Get ID of a scheduler by processor set
626-------------------------------------------------------------------------
627
628CALLING SEQUENCE:
629    .. code-block:: c
630
631        rtems_status_code rtems_scheduler_ident_by_processor_set(
632            size_t           cpusetsize,
633            const cpu_set_t *cpuset,
634            rtems_id        *id
635        );
636
637DIRECTIVE STATUS CODES:
638    .. list-table::
639     :class: rtems-table
640
641     * - ``RTEMS_SUCCESSFUL``
642       - Successful operation.
643     * - ``RTEMS_INVALID_ADDRESS``
644       - The ``id`` parameter is ``NULL``.
645     * - ``RTEMS_INVALID_SIZE``
646       - Invalid processor set size.
647     * - ``RTEMS_INVALID_NAME``
648       - The processor set contains no online processor.
649     * - ``RTEMS_INCORRECT_STATE``
650       - The processor set is valid, however, the highest numbered online
651         processor in the specified processor set is not owned by a scheduler.
652
653DESCRIPTION:
654    Identifies a scheduler by a processor set.  The scheduler is selected
655    according to the highest numbered online processor in the specified
656    processor set.
657
658NOTES:
659    None.
660
661.. raw:: latex
662
663   \clearpage
664
665.. _rtems_scheduler_get_maximum_priority:
666
667SCHEDULER_GET_MAXIMUM_PRIORITY - Get maximum task priority of a scheduler
668-------------------------------------------------------------------------
669
670CALLING SEQUENCE:
671    .. code-block:: c
672
673        rtems_status_code rtems_scheduler_get_maximum_priority(
674            rtems_id             scheduler_id,
675            rtems_task_priority *priority
676        );
677
678DIRECTIVE STATUS CODES:
679    .. list-table::
680     :class: rtems-table
681
682     * - ``RTEMS_SUCCESSFUL``
683       - Successful operation.
684     * - ``RTEMS_INVALID_ID``
685       - Invalid scheduler instance identifier.
686     * - ``RTEMS_INVALID_ADDRESS``
687       - The ``priority`` parameter is ``NULL``.
688
689DESCRIPTION:
690    Returns the maximum task priority of the specified scheduler instance in
691    ``priority``.
692
693NOTES:
694    None.
695
696.. raw:: latex
697
698   \clearpage
699
700.. _rtems_scheduler_get_processor_set:
701
702SCHEDULER_GET_PROCESSOR_SET - Get processor set of a scheduler
703--------------------------------------------------------------
704
705CALLING SEQUENCE:
706    .. code-block:: c
707
708        rtems_status_code rtems_scheduler_get_processor_set(
709            rtems_id   scheduler_id,
710            size_t     cpusetsize,
711            cpu_set_t *cpuset
712        );
713
714DIRECTIVE STATUS CODES:
715    .. list-table::
716     :class: rtems-table
717
718     * - ``RTEMS_SUCCESSFUL``
719       - Successful operation.
720     * - ``RTEMS_INVALID_ID``
721       - Invalid scheduler instance identifier.
722     * - ``RTEMS_INVALID_ADDRESS``
723       - The ``cpuset`` parameter is ``NULL``.
724     * - ``RTEMS_INVALID_NUMBER``
725       - The processor set buffer is too small for the set of processors owned
726         by the scheduler instance.
727
728DESCRIPTION:
729    Returns the processor set owned by the scheduler instance in ``cpuset``.  A
730    set bit in the processor set means that this processor is owned by the
731    scheduler instance and a cleared bit means the opposite.
732
733NOTES:
734    None.
735
736.. raw:: latex
737
738   \clearpage
739
740.. _rtems_scheduler_add_processor:
741
742SCHEDULER_ADD_PROCESSOR - Add processor to a scheduler
743------------------------------------------------------
744
745CALLING SEQUENCE:
746    .. code-block:: c
747
748        rtems_status_code rtems_scheduler_add_processor(
749            rtems_id scheduler_id,
750            uint32_t cpu_index
751        );
752
753DIRECTIVE STATUS CODES:
754    .. list-table::
755     :class: rtems-table
756
757     * - ``RTEMS_SUCCESSFUL``
758       - Successful operation.
759     * - ``RTEMS_INVALID_ID``
760       - Invalid scheduler instance identifier.
761     * - ``RTEMS_NOT_CONFIGURED``
762       - The processor is not configured to be used by the application.
763     * - ``RTEMS_INCORRECT_STATE``
764       - The processor is configured to be used by the application, however, it
765         is not online.
766     * - ``RTEMS_RESOURCE_IN_USE``
767       - The processor is already assigned to a scheduler instance.
768
769DESCRIPTION:
770    Adds a processor to the set of processors owned by the specified scheduler
771    instance.
772
773NOTES:
774    Must be called from task context.  This operation obtains and releases the
775    objects allocator lock.
776
777.. raw:: latex
778
779   \clearpage
780
781.. _rtems_scheduler_remove_processor:
782
783SCHEDULER_REMOVE_PROCESSOR - Remove processor from a scheduler
784--------------------------------------------------------------
785
786CALLING SEQUENCE:
787    .. code-block:: c
788
789        rtems_status_code rtems_scheduler_remove_processor(
790            rtems_id scheduler_id,
791            uint32_t cpu_index
792        );
793
794DIRECTIVE STATUS CODES:
795    .. list-table::
796     :class: rtems-table
797
798     * - ``RTEMS_SUCCESSFUL``
799       - Successful operation.
800     * - ``RTEMS_INVALID_ID``
801       - Invalid scheduler instance identifier.
802     * - ``RTEMS_INVALID_NUMBER``
803       - The processor is not owned by the specified scheduler instance.
804     * - ``RTEMS_RESOURCE_IN_USE``
805       - The set of processors owned by the specified scheduler instance would
806         be empty after the processor removal and there exists a non-idle task
807         that uses this scheduler instance as its home scheduler instance.
808     * - ``RTEMS_RESOURCE_IN_USE``
809       - A task with a restricted processor affinity exists that uses this
810         scheduler instance as its home scheduler instance and it would be no
811         longer possible to allocate a processor for this task after the
812         removal of this processor.
813
814DESCRIPTION:
815    Removes a processor from set of processors owned by the specified scheduler
816    instance.
817
818NOTES:
819    Must be called from task context.  This operation obtains and releases the
820    objects allocator lock.  Removing a processor from a scheduler is a complex
821    operation that involves all tasks of the system.
Note: See TracBrowser for help on using the repository browser.