D.2.5 Round Robin Dispatching
This subclause defines the task dispatching policy
Round_Robin_Within_Priorities and the package Round_Robin.
Round_Robin_Within_Priorities is a task dispatching policy.
The following language-defined
library package exists:
Nonblocking, Global => in out synchronized is
Default_Quantum : constant
Set_Quantum (Pri : in
Quantum : in
Set_Quantum (Low, High : in
Quantum : in
Actual_Quantum (Pri : System.Priority)
Is_Round_Robin (Pri : System.Priority) return
When task dispatching policy Round_Robin_Within_Priorities
is the single policy in effect for a partition, each task with priority
in the range of System.Interrupt_Priority is dispatched according to
The procedures Set_Quantum set the required Quantum
value for a single priority level Pri or a range of priority levels Low
.. High. If no quantum is set for a Round Robin priority level, Default_Quantum
The function Actual_Quantum returns the actual quantum
used by the implementation for the priority level Pri.
The function Is_Round_Robin returns True if priority
Pri is covered by task dispatching policy Round_Robin_Within_Priorities;
otherwise, it returns False.
A call of Actual_Quantum or Set_Quantum raises exception
Dispatching.Dispatching_Policy_Error if a predefined policy other than
Round_Robin_Within_Priorities applies to the specified priority or any
of the priorities in the specified range.
the dispatching rules for FIFO_Within_Priorities apply with the following
When a task is added or moved to the tail of the
ready queue for its base priority, it has an execution time budget equal
to the quantum for that priority level. This will also occur when a blocked
task becomes executable again.
When a task is preempted (by a higher priority
task) and is added to the head of the ready queue for its priority level,
it retains its remaining budget.
While a task is executing, its budget is decreased
by the amount of execution time it uses. The accuracy of this accounting
is the same as that for execution time clocks (see D.14
When a task has exhausted its budget and is without
an inherited priority (and is not executing within a protected operation),
it is moved to the tail of the ready queue for its priority level. This
is a task dispatching point.
An implementation shall allow, for a single partition,
both the task dispatching policy to be specified as Round_Robin_Within_Priorities
and also the locking policy (see D.3
) to be
specified as Ceiling_Locking.
An implementation shall document the quantum values
An implementation shall document the accuracy with
which it detects the exhaustion of the budget of a task.
NOTE 1 Due to implementation constraints,
the quantum value returned by Actual_Quantum can differ from that set
NOTE 2 A task that executes continuously
with an inherited priority will not be subject to round robin dispatching.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe