Library prosa.model.task.cumulative_cost
WCET(n): Cumulative Task Costs
A cumulative cost parameter also induces the ordinary scalar WCET parameter
by considering exactly one job, i.e., WCET(1). We make this conversion a
local instance so that it needs explicit opt-in, as it is a rather rare
case.
#[local,program] Instance task_cost_from_cumulative_cost
{Task : TaskType} `{TaskCumulativeCost Task} : TaskCost Task :=
{
task_cost tsk := task_cumulative_cost tsk 1
}.
{Task : TaskType} `{TaskCumulativeCost Task} : TaskCost Task :=
{
task_cost tsk := task_cumulative_cost tsk 1
}.
Conversely, a legacy scalar WCET parameter induces a default cumulative
bound by multiplying the scalar WCET by the number of arrivals. This is a
compatibility fallback for contexts that provide only a scalar WCET and
hence is made globally visible.
#[global,program] Instance task_cost_as_cumulative_cost
{Task : TaskType} `{TaskCost Task} : TaskCumulativeCost Task :=
{
task_cumulative_cost tsk n := n × task_cost tsk
}.
{Task : TaskType} `{TaskCost Task} : TaskCumulativeCost Task :=
{
task_cumulative_cost tsk n := n × task_cost tsk
}.
In the following section, we define basic validity conditions for
cumulative task costs.
Consider any type of tasks with cumulative cost bounds.
A cumulative cost bound is well-formed if it maps zero arrivals to zero
cost and is monotonic in the number of arrivals.
Definition valid_task_cumulative_cost (tsk : Task) :=
task_cumulative_cost tsk 0 = 0
∧ monotone leq (task_cumulative_cost tsk).
task_cumulative_cost tsk 0 = 0
∧ monotone leq (task_cumulative_cost tsk).
We lift the constraint to task sets.
Definition taskset_has_valid_cumulative_cost_bounds (ts : TaskSet Task) :=
∀ tsk,
tsk \in ts →
valid_task_cumulative_cost tsk.
End ValidTaskCumulativeCost.
∀ tsk,
tsk \in ts →
valid_task_cumulative_cost tsk.
End ValidTaskCumulativeCost.
Next, we define what it means for an arrival sequence to respect a
cumulative cost bound.
Consider any type of tasks with cumulative cost bounds ...
... and any type of jobs associated with these tasks.
Consider a given arrival sequence.
A sequence of jobs js is a consecutive block of arrivals of task tsk
if it occurs contiguously in the list of task arrivals up to some time.
Definition consecutive_task_arrivals (tsk : Task) (js : seq Job) :=
∃ t prefix suffix,
task_arrivals_up_to arr_seq tsk t = prefix ++ js ++ suffix.
∃ t prefix suffix,
task_arrivals_up_to arr_seq tsk t = prefix ++ js ++ suffix.
The arrival sequence respects the cumulative cost bound of task tsk if
every consecutive block of jobs of tsk is bounded by
task_cumulative_cost tsk.
Definition respects_task_cumulative_cost (tsk : Task) :=
∀ js,
consecutive_task_arrivals tsk js →
\sum_(j <- js) job_cost j ≤ task_cumulative_cost tsk (size js).
∀ js,
consecutive_task_arrivals tsk js →
\sum_(j <- js) job_cost j ≤ task_cumulative_cost tsk (size js).
Finally, we lift the validity constraint to task sets.
Definition taskset_respects_cumulative_cost_bounds (ts : TaskSet Task) :=
∀ tsk,
tsk \in ts →
respects_task_cumulative_cost tsk.
End RespectsTaskCumulativeCost.
∀ tsk,
tsk \in ts →
respects_task_cumulative_cost tsk.
End RespectsTaskCumulativeCost.