Library prosa.classic.analysis.global.jitter.bertogna_edf_theory
Require Import prosa.classic.util.all.
Require Import prosa.classic.model.arrival.basic.task prosa.classic.model.priority prosa.classic.model.arrival.basic.task_arrival.
Require Import prosa.classic.model.schedule.global.workload prosa.classic.model.schedule.global.schedulability
prosa.classic.model.schedule.global.response_time.
Require Import prosa.classic.model.schedule.global.jitter.job prosa.classic.model.schedule.global.jitter.schedule
prosa.classic.model.schedule.global.jitter.platform prosa.classic.model.schedule.global.jitter.interference
prosa.classic.model.schedule.global.jitter.constrained_deadlines.
Require Import prosa.classic.analysis.global.jitter.workload_bound
prosa.classic.analysis.global.jitter.interference_bound_edf.
From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop div path.
Module ResponseTimeAnalysisEDFJitter.
Export JobWithJitter SporadicTaskset ScheduleOfSporadicTaskWithJitter Workload
Schedulability ResponseTime Priority TaskArrival WorkloadBoundJitter
InterferenceBoundEDFJitter Platform Interference ConstrainedDeadlines.
Section ResponseTimeBound.
Context {sporadic_task: eqType}.
Variable task_cost: sporadic_task → time.
Variable task_period: sporadic_task → time.
Variable task_deadline: sporadic_task → time.
Variable task_jitter: sporadic_task → time.
Context {Job: eqType}.
Variable job_arrival: Job → time.
Variable job_cost: Job → time.
Variable job_deadline: Job → time.
Variable job_task: Job → sporadic_task.
Variable job_jitter: Job → time.
Context {arr_seq: arrival_sequence Job}.
Hypothesis H_sporadic_tasks:
sporadic_task_model task_period job_arrival job_task arr_seq.
Hypothesis H_valid_job_parameters:
∀ j,
arrives_in arr_seq j →
valid_sporadic_job_with_jitter task_cost task_deadline task_jitter job_cost
job_deadline job_task job_jitter j.
Variable ts: taskset_of sporadic_task.
Hypothesis H_valid_task_parameters:
valid_sporadic_taskset task_cost task_period task_deadline ts.
Hypothesis H_constrained_deadlines:
∀ tsk, tsk \in ts → task_deadline tsk ≤ task_period tsk.
Hypothesis H_all_jobs_from_taskset:
∀ j,
arrives_in arr_seq j →
job_task j \in ts.
Variable num_cpus: nat.
Variable sched: schedule Job num_cpus.
Hypothesis H_jobs_come_from_arrival_sequence:
jobs_come_from_arrival_sequence sched arr_seq.
Hypothesis H_sequential_jobs: sequential_jobs sched.
Hypothesis H_execute_after_jitter:
jobs_execute_after_jitter job_arrival job_jitter sched.
Hypothesis H_completed_jobs_dont_execute:
completed_jobs_dont_execute job_cost sched.
Hypothesis H_at_least_one_cpu: num_cpus > 0.
Hypothesis H_work_conserving: work_conserving job_arrival job_cost job_jitter arr_seq sched.
Hypothesis H_edf_policy: respects_JLFP_policy job_arrival job_cost job_jitter arr_seq sched
(EDF job_arrival job_deadline).
Let no_deadline_is_missed_by_tsk (tsk: sporadic_task) :=
task_misses_no_deadline job_arrival job_cost job_deadline job_task arr_seq sched tsk.
Let response_time_bounded_by (tsk: sporadic_task) :=
is_response_time_bound_of_task job_arrival job_cost job_task arr_seq sched tsk.
Let task_with_response_time := (sporadic_task × time)%type.
Variable rt_bounds: seq task_with_response_time.
Hypothesis H_rt_bounds_contains_all_tasks: unzip1 rt_bounds = ts.
Let I (tsk: sporadic_task) (delta: time) :=
total_interference_bound_edf task_cost task_period task_deadline task_jitter tsk rt_bounds delta.
Hypothesis H_response_time_is_fixed_point :
∀ tsk R,
(tsk, R) \in rt_bounds →
R = task_cost tsk + div_floor (I tsk R) num_cpus.
Hypothesis H_tasks_miss_no_deadlines:
∀ tsk R,
(tsk, R) \in rt_bounds →
task_jitter tsk + R ≤ task_deadline tsk.
Section Lemmas.
Variable tsk: sporadic_task.
Variable R: time.
Hypothesis H_tsk_R_in_rt_bounds: (tsk, R) \in rt_bounds.
Variable j: Job.
Hypothesis H_j_arrives: arrives_in arr_seq j.
Hypothesis H_job_of_tsk: job_task j = tsk.
Let t1 := job_arrival j + job_jitter j.
Hypothesis H_j_not_completed: ~~ completed job_cost sched j (t1 + R).
Hypothesis H_all_previous_jobs_completed_on_time :
∀ j_other tsk_other R_other,
arrives_in arr_seq j_other →
job_task j_other = tsk_other →
(tsk_other, R_other) \in rt_bounds →
job_arrival j_other + task_jitter tsk_other + R_other < job_arrival j + task_jitter tsk + R →
completed job_cost sched j_other (job_arrival j_other + task_jitter tsk_other + R_other).
Let x (tsk_other: sporadic_task) :=
task_interference job_arrival job_cost job_task job_jitter sched j tsk_other t1 (t1 + R).
Let X := total_interference job_arrival job_cost job_jitter sched j t1 (t1 + R).
Let workload_bound (tsk_other: sporadic_task) (R_other: time) :=
W_jitter task_cost task_period task_jitter tsk_other R_other R.
Let edf_specific_bound (tsk_other: sporadic_task) (R_other: time) :=
edf_specific_interference_bound task_cost task_period task_deadline task_jitter tsk tsk_other R_other.
Let interference_bound (tsk_other: sporadic_task) (R_other: time) :=
interference_bound_edf task_cost task_period task_deadline task_jitter tsk R (tsk_other, R_other).
Let other_task := different_task tsk.
Let other_tasks :=
[seq tsk_other <- ts | other_task tsk_other].
Section LemmasAboutInterferingTasks.
Variable tsk_other: sporadic_task.
Variable R_other: time.
Hypothesis H_response_time_of_tsk_other: (tsk_other, R_other) \in rt_bounds.
Lemma bertogna_edf_tsk_other_in_ts: tsk_other \in ts.
Lemma bertogna_edf_R_other_ge_cost :
R_other ≥ task_cost tsk_other.
Lemma bertogna_edf_workload_bounds_interference :
x tsk_other ≤ workload_bound tsk_other R_other.
Lemma bertogna_edf_specific_bound_holds :
x tsk_other ≤ edf_specific_bound tsk_other R_other.
End LemmasAboutInterferingTasks.
Section DerivingContradiction.
Lemma bertogna_edf_too_much_interference : X ≥ R - task_cost tsk + 1.
Lemma bertogna_edf_interference_by_different_tasks :
∀ t j_other,
t1 ≤ t < t1 + R →
backlogged job_arrival job_cost job_jitter sched j t →
scheduled sched j_other t →
job_task j_other != tsk.
Lemma bertogna_edf_all_previous_jobs_complete_by_their_period:
∀ t j0,
t < t1 + R →
arrives_in arr_seq j0 →
job_arrival j0 + task_period (job_task j0) ≤ t →
completed job_cost sched j0
(job_arrival j0 + task_period (job_task j0)).
Let other_scheduled_task (t: time) (tsk_other: sporadic_task) :=
task_is_scheduled job_task sched tsk_other t &&
other_task tsk_other.
Lemma bertogna_edf_all_cpus_are_busy:
∀ t,
t1 ≤ t < t1 + R →
backlogged job_arrival job_cost job_jitter sched j t →
count (other_scheduled_task t) ts = num_cpus.
Lemma bertogna_edf_interference_on_all_cpus :
\sum_(tsk_k <- other_tasks) x tsk_k = X × num_cpus.
Let num_tasks_exceeding delta := count (fun i ⇒ x i ≥ delta) (other_tasks).
Lemma bertogna_edf_interference_in_non_full_processors :
∀ delta,
0 < num_tasks_exceeding delta < num_cpus →
\sum_(i <- other_tasks | x i < delta) x i ≥ delta × (num_cpus - num_tasks_exceeding delta).
Lemma bertogna_edf_minimum_exceeds_interference :
∀ delta,
\sum_(tsk_k <- other_tasks) x tsk_k ≥ delta × num_cpus →
\sum_(tsk_k <- other_tasks) minn (x tsk_k) delta ≥
delta × num_cpus.
Lemma bertogna_edf_sum_exceeds_total_interference:
\sum_((tsk_other, R_other) <- rt_bounds | other_task tsk_other)
minn (x tsk_other) (R - task_cost tsk + 1) > I tsk R.
Lemma bertogna_edf_exists_task_that_exceeds_bound :
∃ tsk_other R_other,
(tsk_other, R_other) \in rt_bounds ∧
(minn (x tsk_other) (R - task_cost tsk + 1) > interference_bound tsk_other R_other).
End DerivingContradiction.
End Lemmas.
Section MainProof.
Variable tsk: sporadic_task.
Variable R: time.
Hypothesis H_tsk_R_in_rt_bounds: (tsk, R) \in rt_bounds.
Theorem bertogna_cirinei_response_time_bound_edf :
response_time_bounded_by tsk (task_jitter tsk + R).
End MainProof.
End ResponseTimeBound.
End ResponseTimeAnalysisEDFJitter.
Require Import prosa.classic.model.arrival.basic.task prosa.classic.model.priority prosa.classic.model.arrival.basic.task_arrival.
Require Import prosa.classic.model.schedule.global.workload prosa.classic.model.schedule.global.schedulability
prosa.classic.model.schedule.global.response_time.
Require Import prosa.classic.model.schedule.global.jitter.job prosa.classic.model.schedule.global.jitter.schedule
prosa.classic.model.schedule.global.jitter.platform prosa.classic.model.schedule.global.jitter.interference
prosa.classic.model.schedule.global.jitter.constrained_deadlines.
Require Import prosa.classic.analysis.global.jitter.workload_bound
prosa.classic.analysis.global.jitter.interference_bound_edf.
From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop div path.
Module ResponseTimeAnalysisEDFJitter.
Export JobWithJitter SporadicTaskset ScheduleOfSporadicTaskWithJitter Workload
Schedulability ResponseTime Priority TaskArrival WorkloadBoundJitter
InterferenceBoundEDFJitter Platform Interference ConstrainedDeadlines.
Section ResponseTimeBound.
Context {sporadic_task: eqType}.
Variable task_cost: sporadic_task → time.
Variable task_period: sporadic_task → time.
Variable task_deadline: sporadic_task → time.
Variable task_jitter: sporadic_task → time.
Context {Job: eqType}.
Variable job_arrival: Job → time.
Variable job_cost: Job → time.
Variable job_deadline: Job → time.
Variable job_task: Job → sporadic_task.
Variable job_jitter: Job → time.
Context {arr_seq: arrival_sequence Job}.
Hypothesis H_sporadic_tasks:
sporadic_task_model task_period job_arrival job_task arr_seq.
Hypothesis H_valid_job_parameters:
∀ j,
arrives_in arr_seq j →
valid_sporadic_job_with_jitter task_cost task_deadline task_jitter job_cost
job_deadline job_task job_jitter j.
Variable ts: taskset_of sporadic_task.
Hypothesis H_valid_task_parameters:
valid_sporadic_taskset task_cost task_period task_deadline ts.
Hypothesis H_constrained_deadlines:
∀ tsk, tsk \in ts → task_deadline tsk ≤ task_period tsk.
Hypothesis H_all_jobs_from_taskset:
∀ j,
arrives_in arr_seq j →
job_task j \in ts.
Variable num_cpus: nat.
Variable sched: schedule Job num_cpus.
Hypothesis H_jobs_come_from_arrival_sequence:
jobs_come_from_arrival_sequence sched arr_seq.
Hypothesis H_sequential_jobs: sequential_jobs sched.
Hypothesis H_execute_after_jitter:
jobs_execute_after_jitter job_arrival job_jitter sched.
Hypothesis H_completed_jobs_dont_execute:
completed_jobs_dont_execute job_cost sched.
Hypothesis H_at_least_one_cpu: num_cpus > 0.
Hypothesis H_work_conserving: work_conserving job_arrival job_cost job_jitter arr_seq sched.
Hypothesis H_edf_policy: respects_JLFP_policy job_arrival job_cost job_jitter arr_seq sched
(EDF job_arrival job_deadline).
Let no_deadline_is_missed_by_tsk (tsk: sporadic_task) :=
task_misses_no_deadline job_arrival job_cost job_deadline job_task arr_seq sched tsk.
Let response_time_bounded_by (tsk: sporadic_task) :=
is_response_time_bound_of_task job_arrival job_cost job_task arr_seq sched tsk.
Let task_with_response_time := (sporadic_task × time)%type.
Variable rt_bounds: seq task_with_response_time.
Hypothesis H_rt_bounds_contains_all_tasks: unzip1 rt_bounds = ts.
Let I (tsk: sporadic_task) (delta: time) :=
total_interference_bound_edf task_cost task_period task_deadline task_jitter tsk rt_bounds delta.
Hypothesis H_response_time_is_fixed_point :
∀ tsk R,
(tsk, R) \in rt_bounds →
R = task_cost tsk + div_floor (I tsk R) num_cpus.
Hypothesis H_tasks_miss_no_deadlines:
∀ tsk R,
(tsk, R) \in rt_bounds →
task_jitter tsk + R ≤ task_deadline tsk.
Section Lemmas.
Variable tsk: sporadic_task.
Variable R: time.
Hypothesis H_tsk_R_in_rt_bounds: (tsk, R) \in rt_bounds.
Variable j: Job.
Hypothesis H_j_arrives: arrives_in arr_seq j.
Hypothesis H_job_of_tsk: job_task j = tsk.
Let t1 := job_arrival j + job_jitter j.
Hypothesis H_j_not_completed: ~~ completed job_cost sched j (t1 + R).
Hypothesis H_all_previous_jobs_completed_on_time :
∀ j_other tsk_other R_other,
arrives_in arr_seq j_other →
job_task j_other = tsk_other →
(tsk_other, R_other) \in rt_bounds →
job_arrival j_other + task_jitter tsk_other + R_other < job_arrival j + task_jitter tsk + R →
completed job_cost sched j_other (job_arrival j_other + task_jitter tsk_other + R_other).
Let x (tsk_other: sporadic_task) :=
task_interference job_arrival job_cost job_task job_jitter sched j tsk_other t1 (t1 + R).
Let X := total_interference job_arrival job_cost job_jitter sched j t1 (t1 + R).
Let workload_bound (tsk_other: sporadic_task) (R_other: time) :=
W_jitter task_cost task_period task_jitter tsk_other R_other R.
Let edf_specific_bound (tsk_other: sporadic_task) (R_other: time) :=
edf_specific_interference_bound task_cost task_period task_deadline task_jitter tsk tsk_other R_other.
Let interference_bound (tsk_other: sporadic_task) (R_other: time) :=
interference_bound_edf task_cost task_period task_deadline task_jitter tsk R (tsk_other, R_other).
Let other_task := different_task tsk.
Let other_tasks :=
[seq tsk_other <- ts | other_task tsk_other].
Section LemmasAboutInterferingTasks.
Variable tsk_other: sporadic_task.
Variable R_other: time.
Hypothesis H_response_time_of_tsk_other: (tsk_other, R_other) \in rt_bounds.
Lemma bertogna_edf_tsk_other_in_ts: tsk_other \in ts.
Lemma bertogna_edf_R_other_ge_cost :
R_other ≥ task_cost tsk_other.
Lemma bertogna_edf_workload_bounds_interference :
x tsk_other ≤ workload_bound tsk_other R_other.
Lemma bertogna_edf_specific_bound_holds :
x tsk_other ≤ edf_specific_bound tsk_other R_other.
End LemmasAboutInterferingTasks.
Section DerivingContradiction.
Lemma bertogna_edf_too_much_interference : X ≥ R - task_cost tsk + 1.
Lemma bertogna_edf_interference_by_different_tasks :
∀ t j_other,
t1 ≤ t < t1 + R →
backlogged job_arrival job_cost job_jitter sched j t →
scheduled sched j_other t →
job_task j_other != tsk.
Lemma bertogna_edf_all_previous_jobs_complete_by_their_period:
∀ t j0,
t < t1 + R →
arrives_in arr_seq j0 →
job_arrival j0 + task_period (job_task j0) ≤ t →
completed job_cost sched j0
(job_arrival j0 + task_period (job_task j0)).
Let other_scheduled_task (t: time) (tsk_other: sporadic_task) :=
task_is_scheduled job_task sched tsk_other t &&
other_task tsk_other.
Lemma bertogna_edf_all_cpus_are_busy:
∀ t,
t1 ≤ t < t1 + R →
backlogged job_arrival job_cost job_jitter sched j t →
count (other_scheduled_task t) ts = num_cpus.
Lemma bertogna_edf_interference_on_all_cpus :
\sum_(tsk_k <- other_tasks) x tsk_k = X × num_cpus.
Let num_tasks_exceeding delta := count (fun i ⇒ x i ≥ delta) (other_tasks).
Lemma bertogna_edf_interference_in_non_full_processors :
∀ delta,
0 < num_tasks_exceeding delta < num_cpus →
\sum_(i <- other_tasks | x i < delta) x i ≥ delta × (num_cpus - num_tasks_exceeding delta).
Lemma bertogna_edf_minimum_exceeds_interference :
∀ delta,
\sum_(tsk_k <- other_tasks) x tsk_k ≥ delta × num_cpus →
\sum_(tsk_k <- other_tasks) minn (x tsk_k) delta ≥
delta × num_cpus.
Lemma bertogna_edf_sum_exceeds_total_interference:
\sum_((tsk_other, R_other) <- rt_bounds | other_task tsk_other)
minn (x tsk_other) (R - task_cost tsk + 1) > I tsk R.
Lemma bertogna_edf_exists_task_that_exceeds_bound :
∃ tsk_other R_other,
(tsk_other, R_other) \in rt_bounds ∧
(minn (x tsk_other) (R - task_cost tsk + 1) > interference_bound tsk_other R_other).
End DerivingContradiction.
End Lemmas.
Section MainProof.
Variable tsk: sporadic_task.
Variable R: time.
Hypothesis H_tsk_R_in_rt_bounds: (tsk, R) \in rt_bounds.
Theorem bertogna_cirinei_response_time_bound_edf :
response_time_bounded_by tsk (task_jitter tsk + R).
End MainProof.
End ResponseTimeBound.
End ResponseTimeAnalysisEDFJitter.