Tasks
RealTimeScheduling provides several different representations of real-time tasks. These include periodic tasks with implicit or explicit deadlines. Periodic tasks with weakly hard constraints are also supported.
RealTimeScheduling.AbstractRealTimeTask
— TypeAbstract parent type of all real-time task types
RealTimeScheduling.PeriodicTask
— TypePeriodicTask{S}(period::S, deadline::S, cost::S)
Concrete type for periodic real-time tasks.
RealTimeScheduling.PeriodicImplicitTask
— TypePeriodicImplicitTask{S}(period::S, cost::S)
Concrete type for periodic real-time tasks with implicit deadline.
RealTimeScheduling.PeriodicWeaklyHardTask
— TypePeriodicWeaklyHardTask{S, R}(period::S, deadline::S, cost::S, constraint::R)
Concrete type for periodic tasks with a weakly hard constraint.
The task types can be converted to one another automatically, and PeriodicImplicitTask
objects can also be promoted to PeriodicTask
when required (e.g. when putting both types of task into a single TaskSystem
).
Task Attributes
Of course, methods are provided to get a task's period, relative deadline, and execution cost.
RealTimeScheduling.period
— Methodperiod(τ::AbstractRealTimeTask)
Return the period of the real-time task τ
.
RealTimeScheduling.deadline
— Methoddeadline(τ::AbstractRealTimeTask)
Return the deadline of the real-time task τ
.
RealTimeScheduling.cost
— Methodcost(τ::AbstractRealTimeTask)
Return the cost, or worst-case execution time, of the real-time task τ
.
Utilization and density can be computed easily as well.
RealTimeScheduling.utilization
— Methodutilization(τ::AbstractRealTimeTask)
Compute the utilization of real-time task τ
, cost/period.
See also density
.
RealTimeScheduling.density
— Methoddensity(τ::AbstractRealTimeTask)
Compute the density of real-time task τ
, cost/min(period, deadline).
See also utilization
.
For weakly hard tasks, the minimum utilization and density may also be computed, multiplying the utilization and density by the maximum fraction of jobs that can be missed in an unbounded time horizon.
RealTimeScheduling.min_utilization
— Methodmin_utilization(τ::PeriodicWeaklyHardTask)
Compute the minimum utilization of weakly hard real-time task τ
, representing the utilization of the task if as few jobs as possible are executed.
See also utilization
, density
, and min_density
.
RealTimeScheduling.min_density
— Methodmin_density(τ::PeriodicWeaklyHardTask)
Compute the minimum density of weakly hard real-time task τ
, representing the density of the task if as few jobs as possible are executed.
See also utilization
, density
, and min_utilization
.
Testing Properties of Tasks
Sometimes it's useful to know how the deadline of a task relates to its period. RealTimeScheduling provides two functions for this.
RealTimeScheduling.implicit_deadline
— Methodimplicit_deadline(τ::AbstractRealTimeTask)
Test whether the real-time task τ
has relative deadline equal to period.
RealTimeScheduling.constrained_deadline
— Methodconstrained_deadline(τ::AbstractRealTimeTask)
Test whether the real-time task τ
has relative deadline at most period.
Additionally, it's often important to know if a task's cost exceeds its period.
RealTimeScheduling.feasible
— Methodfeasible(τ::AbstractRealTimeTask)
Test whether the real-time task τ
is feasible, i.e. its density is at most 1.
Time-Demand Analysis
Many schedulability tests make use of time-demand analysis (TDA). To support this, the common demand bound function (DBF) and request bound function (RBF) are implemented.
RealTimeScheduling.demand_bound
— Methoddemand_bound(τ::AbstractRealTimeTask, t)
Compute Baruah's demand bound function (DBF) for the task τ
.
\[\max\left(0, \left\lfloor \frac{t - \mathrm{deadline}(τ)}{\mathrm{period}(τ)} + 1 \right\rfloor \mathrm{cost}(τ) \right)\]
RealTimeScheduling.request_bound
— Methodrequest_bound(τ::AbstractRealTimeTask, t)
Compute the request bound function (RBF) for the task τ
.
\[\left\lceil \frac{t}{\mathrm{period}(τ)}\right\rceil \mathrm{cost}(τ)\]