Dispatching#
The task dispatching model specifies task scheduling, based on conceptual priority-ordered ready queues.
package Ada.Dispatching
with Preelaborate, Nonblocking, Global => in out synchronized is
procedure Yield with Nonblocking => False;
Dispatching_Policy_Error: exception;
end Ada.Dispatching;
Earliest Deadline First#
The deadline of a task is an indication of the urgency of the task; it represents a point on an ideal physical time line. The deadline can affect how resources are allocated to the task.
This subclause presents Dispatching.EDF
, a package for representing the deadline of a task and a dispatching
policy that defines Earliest Deadline First (EDF) dispatching. The Relative_Deadline
aspect is provided to
assign an initial deadline to a task. A configuration pragma Generate_Deadlines
is provided to specify that a
task’s deadline is recomputed whenever it is made ready.
with Ada.Real_Time;
with Ada.Task_Identification;
package Ada.Dispatching.EDF
with Nonblocking, Global => in out synchronized is
subtype Deadline is Ada.Real_Time.Time;
subtype Relative_Deadline is Ada.Real_Time.Time_Span;
Default_Deadline : constant Deadline := Ada.Real_Time.Time_Last;
Default_Relative_Deadline: constant Relative_Deadline := Ada.Real_Time.Time_Span_Last;
procedure Set_Deadline(D: Deadline; T: Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task);
function Get_Deadline(T: Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task)
return Deadline;
procedure Set_Relative_Deadline(D: Relative_Deadline; T: Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task);
function Get_Relative_Deadline(T: Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task)
return Relative_Deadline;
procedure Delay_Until_And_Set_Deadline(Delay_Until_Time: Ada.Real_Time.Time;
Deadline_Offset : Ada.Real_Time.Time_Span)
with Nonblocking => False;
function Get_Last_Release_Time(T: Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task)
return Ada.Real_Time.Time;;
end Ada.Dispatching.EDF;
Legality Rules
The Relative_Deadline
aspect shall not be specified on a task or protected interface type. If the
Relative_Deadline
aspect is specified for a subprogram, the aspect_definition shall be a static expression.
Erroneous Execution
If a value of Task_Id
is passed as a parameter to any of the subprograms of this package and the
corresponding task object no longer exists, the execution of the program is erroneous.