source: rtems-docs/c-user/scheduling_concepts.rst @ 8010b6e

5am
Last change on this file since 8010b6e was 8010b6e, checked in by Sebastian Huber <sebastian.huber@…>, on 03/07/18 at 12:43:07

c-user: Update CONFIGURE_SCHEDULER_NAME

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