Commit d5cf8f9d authored by Felipe Cerqueira's avatar Felipe Cerqueira

Keep only the definition of parallel interference

parent 7ac7144a
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -556,23 +556,18 @@ Module InterferenceBoundEDFJitter.
\sum_(a_fst + J_k + R_k <= t < a_fst + D_k) 1).
{
apply leq_add; last by rewrite SUBST.
by unfold job_interference; apply leq_sum; ins; apply leq_b1.
simpl_sum_const; rewrite -{1}[_ + R_k](addKn a_i) -addnBA //;
last by apply leq_trans with (n := t1); first by apply leq_addr.
by apply job_interference_le_delta.
}
rewrite -big_cat_nat; simpl; last first.
rewrite -big_cat_nat; simpl; last by rewrite -addnA leq_add2l H_R_k_le_deadline.
{
rewrite -addnA leq_add2l.
by apply H_R_k_le_deadline.
}
{
by apply leq_trans with (n := t1); first by apply leq_addr.
}
{
rewrite big_const_nat iter_addn mul1n addn0 leq_subLR.
unfold D_i, D_k, t1, a_fst.
simpl_sum_const; rewrite leq_subLR; unfold D_i, D_k, t1, a_fst.
by rewrite -interference_bound_edf_j_fst_deadline
-interference_bound_edf_j_i_deadline.
}
by apply leq_trans with (n := t1); first by apply leq_addr.
Qed.
End ResponseTimeOfSingleJobBounded.
......@@ -652,9 +647,16 @@ Module InterferenceBoundEDFJitter.
apply leq_trans with (n := \sum_(t1 <= t < a_fst + J_k + R_k) 1 +
\sum_(a_fst + J_k + R_k <= t < a_fst + D_k)1).
{
apply leq_add; unfold job_interference;
first by apply leq_sum; ins; apply leq_b1.
rewrite big_const_nat iter_addn mul1n addn0 addnC.
apply leq_add; unfold job_interference.
{
simpl_sum_const.
rewrite -{1}[job_arrival j_fst + J_k + R_k](addKn t1) -addnBA;
first by apply job_interference_le_delta.
apply leq_trans with (n := a_i + J_i + delta); last by done.
apply leq_trans with (n := a_i + J_i); last by apply leq_addr.
by rewrite leq_add2l /J_i -H_job_of_tsk_i; apply PARAMS0.
}
simpl_sum_const; rewrite addnC.
rewrite -subnBA; last by rewrite -addnA leq_addr.
rewrite [a_fst + _]addnC -addnA [a_fst + _]addnC addnA.
rewrite -addnBA // subnn addn0.
......@@ -1034,14 +1036,18 @@ Module InterferenceBoundEDFJitter.
apply leq_trans with (n := job_interference job_cost job_jitter sched j_i j_fst t1
(a_fst + J_k + R_k));
first by apply extend_sum; rewrite ?leqnn.
by apply leq_sum; ins; rewrite leq_b1.
simpl_sum_const; rewrite -{1}[_ + _ + R_k](addKn t1) -addnBA //.
by apply job_interference_le_delta.
}
{
unfold interference_caused_by, job_interference.
rewrite -> big_cat_nat with (n := a_fst + J_k + R_k);
[simpl | by apply AFTERt1 | by apply ltnW].
rewrite -[\sum_(_ <= _ < _) 1]addn0; apply leq_add;
first by apply leq_sum; ins; apply leq_b1.
rewrite -[\sum_(_ <= _ < _) 1]addn0; apply leq_add.
{
simpl_sum_const; rewrite -{1}[_ + _ + R_k](addKn t1) -addnBA //.
by apply job_interference_le_delta.
}
apply leq_trans with (n := service_during sched j_fst (a_fst + J_k + R_k) t2);
first by apply job_interference_le_service.
rewrite leqn0; apply/eqP.
......
......@@ -290,9 +290,9 @@ Module ResponseTimeAnalysisEDF.
rewrite (bigD1_seq (job_task j_other)) /=; last by rewrite filter_uniq.
{
rewrite (eq_bigr (fun i => 0));
last by intros i DIFF; rewrite /schedules_job_of_task SCHED;apply/eqP;rewrite eqb0 eq_sym.
last by intros i DIFF; rewrite /task_scheduled_on SCHED;apply/eqP;rewrite eqb0 eq_sym.
rewrite big_const_seq iter_addn mul0n 2!addn0; apply/eqP; rewrite eqb1.
by unfold schedules_job_of_task; rewrite SCHED.
by unfold task_scheduled_on; rewrite SCHED.
}
rewrite mem_filter; apply/andP; split; last by apply FROMTS.
unfold jldp_can_interfere_with.
......@@ -300,7 +300,7 @@ Module ResponseTimeAnalysisEDF.
assert (SCHED': scheduled sched j_other t).
{
unfold scheduled, scheduled_on.
by apply/exists_inP; exists cpu; [by done | rewrite SCHED].
by apply/existsP; exists cpu; rewrite SCHED.
}
clear SCHED; rename SCHED' into SCHED.
move: (SCHED) => PENDING.
......
......@@ -9,7 +9,7 @@ Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop div path.
Module ResponseTimeAnalysisFP.
Export Job SporadicTaskset Schedule Workload Interference InterferenceBoundFP
Export Job SporadicTaskset ScheduleOfSporadicTask Workload Interference InterferenceBoundFP
Platform PlatformFP Schedulability ResponseTime Priority SporadicTaskArrival WorkloadBound.
Section ResponseTimeBound.
......@@ -281,23 +281,23 @@ Module ResponseTimeAnalysisFP.
rewrite (bigD1_seq (job_task j_other)) /=; last by rewrite filter_uniq.
{
rewrite (eq_bigr (fun i => 0));
last by intros i DIFF; rewrite /schedules_job_of_task SCHED;apply/eqP;rewrite eqb0 eq_sym.
last by intros i DIFF; rewrite /task_scheduled_on SCHED;apply/eqP;rewrite eqb0 eq_sym.
rewrite big_const_seq iter_addn mul0n 2!addn0; apply/eqP; rewrite eqb1.
by unfold schedules_job_of_task; rewrite SCHED.
by unfold task_scheduled_on; rewrite SCHED.
}
rewrite mem_filter; apply/andP; split; last by apply FROMTS.
unfold can_interfere_with_tsk, fp_can_interfere_with.
apply/andP; split.
{
rewrite -JOBtsk; apply FP with (t := t); first by done.
by apply/exists_inP; exists cpu; last by apply/eqP.
by apply/existsP; exists cpu; apply/eqP.
}
{
apply/eqP; intro SAMEtsk.
assert (SCHED': scheduled sched j_other t).
{
unfold scheduled, scheduled_on.
by apply/exists_inP; exists cpu; [by done | rewrite SCHED].
by apply/existsP; exists cpu; rewrite SCHED.
} clear SCHED; rename SCHED' into SCHED.
move: (SCHED) => PENDING.
apply scheduled_implies_pending with (job_cost0 := job_cost) in PENDING; try (by done).
......
......@@ -240,9 +240,9 @@ Module InterferenceBoundEDF.
last by rewrite andFb (eq_bigr (fun x => 0));
first by rewrite big_const_seq iter_addn mul0n addn0.
rewrite andTb.
destruct (schedules_job_of_task job_task sched tsk_k cpu t) eqn:SCHED;
destruct (task_scheduled_on job_task sched tsk_k cpu t) eqn:SCHED;
last by done.
unfold schedules_job_of_task in *.
unfold task_scheduled_on in *.
destruct (sched cpu t) eqn:SOME; last by done.
rewrite big_mkcond /= (bigD1_seq j) /=; last by apply undup_uniq.
{
......
......@@ -157,7 +157,7 @@ Module ConcreteScheduler.
nth_or_none (sorted_jobs t) cpu = Some j.
Proof.
intros j t SCHED.
move: SCHED => /exists_inP [cpu INcpu /eqP SCHED]; exists cpu.
move: SCHED => /existsP [cpu /eqP SCHED]; exists cpu.
by apply scheduler_nth_or_none_mapping.
Qed.
......@@ -181,7 +181,7 @@ Module ConcreteScheduler.
exists n; split; first by done.
rewrite leqNgt; apply/negP; red; intro LT.
apply NOTCOMP; clear NOTCOMP PENDING.
apply/exists_inP; exists (Ordinal LT); [by done | apply/eqP].
apply/existsP; exists (Ordinal LT); apply/eqP.
unfold sorted_jobs in *; clear sorted_jobs.
unfold sched, scheduler, schedule_prefix in *; clear sched.
destruct t.
......@@ -220,7 +220,7 @@ Module ConcreteScheduler.
Proof.
unfold jobs_must_arrive_to_execute.
intros j t SCHED.
move: SCHED => /existsP [cpu /andP [INcpu /eqP SCHED]].
move: SCHED => /existsP [cpu /eqP SCHED].
unfold sched, scheduler, schedule_prefix in SCHED.
destruct t.
{
......
......@@ -159,8 +159,7 @@ Module ConcreteScheduler.
exists (cpu: processor num_cpus),
nth_or_none (sorted_jobs t) cpu = Some j.
Proof.
intros j t SCHED.
move: SCHED => /exists_inP [cpu INcpu /eqP SCHED]; exists cpu.
move => j t /existsP [cpu /eqP SCHED]; exists cpu.
by apply scheduler_nth_or_none_mapping.
Qed.
......@@ -186,7 +185,7 @@ Module ConcreteScheduler.
exists n; split; first by done.
rewrite leqNgt; apply/negP; red; intro LT.
apply NOTCOMP; clear NOTCOMP PENDING.
apply/exists_inP; exists (Ordinal LT); [by done | apply/eqP].
apply/existsP; exists (Ordinal LT); apply/eqP.
unfold sorted_jobs in *; clear sorted_jobs.
unfold sched, scheduler, schedule_prefix in *; clear sched.
destruct t.
......@@ -225,7 +224,7 @@ Module ConcreteScheduler.
Proof.
unfold jobs_must_arrive_to_execute.
intros j t SCHED.
move: SCHED => /existsP [cpu /andP [INcpu /eqP SCHED]].
move: SCHED => /existsP [cpu /eqP SCHED].
unfold sched, scheduler, schedule_prefix in SCHED.
destruct t.
{
......
This diff is collapsed.
......@@ -28,34 +28,7 @@ Module InterferenceEDF.
Hypothesis H_scheduler_uses_EDF:
enforces_JLDP_policy job_cost sched (EDF job_deadline).
(* Under EDF scheduling, a job only causes sequential interference if its deadline
is not larger than the deadline of the analyzed job. *)
Lemma interference_seq_under_edf_implies_shorter_deadlines :
forall (j j': JobIn arr_seq) t1 t2,
job_interference_sequential job_cost sched j' j t1 t2 != 0 ->
job_arrival j + job_deadline j <= job_arrival j' + job_deadline j'.
Proof.
rename H_scheduler_uses_EDF into PRIO.
intros j j' t1 t2 INTERF.
unfold job_interference_sequential in INTERF.
destruct ([exists t': 'I_t2, (t' >= t1) && backlogged job_cost sched j' t' &&
scheduled sched j t']) eqn:EX.
{
move: EX => /existsP EX; destruct EX as [t' EX];move: EX => /andP [/andP [LE BACK] SCHED].
by eapply PRIO in SCHED; last by apply BACK.
}
{
apply negbT in EX; rewrite negb_exists in EX; move: EX => /forallP ALL.
rewrite big_nat_cond (eq_bigr (fun x => 0)) in INTERF;
first by rewrite -big_nat_cond big_const_nat iter_addn mul0n addn0 eq_refl in INTERF.
intros i; rewrite andbT; move => /andP [GT LT].
specialize (ALL (Ordinal LT)); simpl in ALL.
rewrite -andbA negb_and -implybE in ALL; move: ALL => /implyP ALL.
by specialize (ALL GT); apply/eqP; rewrite eqb0.
}
Qed.
(* Under EDF scheduling, a job only causes (parallel) interference if its deadline
(* Under EDF scheduling, a job only causes interference if its deadline
is not larger than the deadline of the analyzed job. *)
Lemma interference_under_edf_implies_shorter_deadlines :
forall (j j': JobIn arr_seq) t1 t2,
......@@ -67,11 +40,13 @@ Module InterferenceEDF.
unfold job_interference in INTERF.
destruct ([exists t': 'I_t2,
[exists cpu: processor num_cpus,
(t' >= t1) && backlogged job_cost sched j' t' &&
scheduled sched j t']]) eqn:EX.
(t' >= t1) &&
backlogged job_cost sched j' t' &&
scheduled_on sched j cpu t']]) eqn:EX.
{
move: EX => /existsP [t' /existsP [cpu /andP [/andP [LE BACK] SCHED]]].
by eapply PRIO in SCHED; last by apply BACK.
apply PRIO with (t := t'); first by done.
by apply/existsP; exists cpu.
}
{
apply negbT in EX; rewrite negb_exists in EX; move: EX => /forallP ALL.
......@@ -86,13 +61,10 @@ Module InterferenceEDF.
intros cpu _; specialize (ALL cpu); simpl in ALL.
destruct (backlogged job_cost sched j' i); last by rewrite andFb.
rewrite GEi 2!andTb in ALL; rewrite andTb.
rewrite negb_exists in ALL; move: ALL => /forallP NOTSCHED.
specialize (NOTSCHED cpu); rewrite negb_and in NOTSCHED.
move: NOTSCHED => /orP [BUG | NOTSCHED]; first by done.
by apply/eqP; rewrite eqb0.
by apply negbTE in ALL; rewrite ALL.
}
Qed.
End Lemmas.
End InterferenceEDF.
\ No newline at end of file
......@@ -274,7 +274,7 @@ Module Platform.
apply count_exists; first by done.
{
intros cpu x1 x2 SCHED1 SCHED2.
unfold schedules_job_of_task in *.
unfold task_scheduled_on in *.
destruct (sched cpu t); last by done.
move: SCHED1 SCHED2 => /eqP SCHED1 /eqP SCHED2.
by rewrite -SCHED1 -SCHED2.
......@@ -300,9 +300,8 @@ Module Platform.
rewrite mem_scheduled_jobs_eq_scheduled in SCHED'.
unfold scheduled_task_other_than; apply/andP; split.
{
move: SCHED' => /exists_inP [cpu INcpu /eqP SCHED'].
apply/exists_inP; exists cpu; first by done.
by unfold schedules_job_of_task; rewrite SCHED' eq_refl.
move: SCHED' => /existsP [cpu /eqP SCHED'].
by apply/existsP; exists cpu; rewrite /task_scheduled_on SCHED' eq_refl.
}
{
apply/eqP; red; intro SAMEtsk; symmetry in SAMEtsk.
......
......@@ -206,7 +206,7 @@ Module PlatformFP.
apply count_exists; first by done.
{
intros cpu x1 x2 SCHED1 SCHED2.
unfold schedules_job_of_task in *.
unfold task_scheduled_on in *.
destruct (sched cpu t); last by done.
move: SCHED1 SCHED2 => /eqP SCHED1 /eqP SCHED2.
by rewrite -SCHED1 -SCHED2.
......@@ -248,9 +248,8 @@ Module PlatformFP.
rewrite mem_scheduled_jobs_eq_scheduled in SCHED'.
apply/andP; split.
{
move: SCHED' => /exists_inP [cpu INcpu /eqP SCHED'].
apply/exists_inP; exists cpu; first by done.
by unfold schedules_job_of_task; rewrite SCHED' eq_refl.
move: SCHED' => /existsP [cpu /eqP SCHED'].
by apply/existsP; exists cpu; rewrite /task_scheduled_on SCHED' eq_refl.
}
apply/andP; split; first by rewrite -JOBtsk; apply PRIO with (t := t).
{
......
......@@ -49,7 +49,7 @@ Module Schedule.
(* A job j is scheduled at time t iff there exists a cpu where it is mapped.*)
Definition scheduled (t: time) :=
[exists cpu in 'I_(num_cpus), scheduled_on cpu t].
[exists cpu, scheduled_on cpu t].
(* A processor cpu is idle at time t if it doesn't contain any jobs. *)
Definition is_idle (cpu: 'I_(num_cpus)) (t: time) :=
......@@ -150,21 +150,19 @@ Module Schedule.
unfold scheduled, service_at, scheduled_on; intros t; apply/idP/idP.
{
intros NOTSCHED.
rewrite negb_exists_in in NOTSCHED.
move: NOTSCHED => /forall_inP NOTSCHED.
rewrite negb_exists in NOTSCHED.
move: NOTSCHED => /forallP NOTSCHED.
rewrite big_seq_cond.
rewrite -> eq_bigr with (F2 := fun i => 0);
first by rewrite big_const_seq iter_addn mul0n addn0.
move => cpu /andP [_ SCHED].
exploit (NOTSCHED cpu); [by ins | clear NOTSCHED].
by move: SCHED => /eqP SCHED; rewrite SCHED eq_refl.
move => cpu /andP [_ /eqP SCHED].
by specialize (NOTSCHED cpu); rewrite SCHED eq_refl in NOTSCHED.
}
{
intros NOSERV; rewrite big_mkcond -sum_nat_eq0_nat in NOSERV.
move: NOSERV => /allP ALL.
rewrite negb_exists; apply/forall_inP.
move => x /andP [IN SCHED].
by exploit (ALL x); [by apply mem_index_enum | by desf].
rewrite negb_exists; apply/forallP; intros cpu.
exploit (ALL cpu); [by apply mem_index_enum | by desf].
}
Qed.
......@@ -224,25 +222,21 @@ Module Schedule.
unfold service_at, sequential_jobs in *; ins.
destruct (scheduled sched j t) eqn:SCHED; unfold scheduled in SCHED.
{
move: SCHED => /exists_inP SCHED; des.
move: H2 => /eqP SCHED.
rewrite -big_filter.
rewrite (bigD1_seq x);
[simpl | | by rewrite filter_index_enum enum_uniq]; last first.
{
by rewrite mem_filter; apply/andP; split;
[by apply/eqP | by rewrite mem_index_enum].
}
move: SCHED => /existsP [cpu SCHED]; des.
rewrite -big_filter (bigD1_seq cpu);
[simpl | | by rewrite filter_index_enum enum_uniq];
last by rewrite mem_filter; apply/andP; split.
rewrite -big_filter -filter_predI big_filter.
rewrite -> eq_bigr with (F2 := fun cpu => 0);
first by rewrite /= big_const_seq iter_addn mul0n 2!addn0.
intro i; move => /andP [/eqP NEQ /eqP SCHEDi].
by apply H_sequential_jobs with (cpu1 := x) in SCHEDi; subst.
intro cpu'; move => /andP [/eqP NEQ /eqP SCHED'].
exfalso; apply NEQ.
by apply H_sequential_jobs with (j := j) (t := t); last by apply/eqP.
}
{
apply negbT in SCHED; rewrite negb_exists_in in SCHED.
move: SCHED => /forall_inP SCHED.
by rewrite big_pred0; red; ins; apply negbTE, SCHED.
apply negbT in SCHED; rewrite negb_exists in SCHED.
move: SCHED => /forallP SCHED.
rewrite big_pred0; red; ins; apply negbTE, SCHED.
}
Qed.
......@@ -339,11 +333,9 @@ Module Schedule.
(b := has_arrived j t) in ARR;
last by rewrite -ltnNge.
apply/eqP; rewrite -leqn0; unfold service_at.
rewrite -> eq_bigr with (F2 := fun cpu => 0);
first by rewrite big_const_seq iter_addn mul0n addn0.
intros i SCHED; move: ARR; rewrite negb_exists_in; move => /forall_inP ARR.
unfold scheduled_on in *.
by exploit (ARR i); [by ins | ins]; destruct (sched i t == Some j).
rewrite big_pred0 //; red.
intros cpu; apply negbTE.
by move: ARR; rewrite negb_exists; move => /forallP ARR; apply ARR.
Qed.
(* The same applies for the cumulative service received by job j. *)
......@@ -434,12 +426,12 @@ Module Schedule.
{
intros IN.
apply mem_bigcat_ord_exists in IN; des.
apply/exists_inP; exists i; first by done.
apply/existsP; exists i.
destruct (sched i t); last by done.
by rewrite mem_seq1 in IN; move: IN => /eqP IN; subst.
}
{
move => /exists_inP EX; destruct EX as [i IN SCHED].
move => /existsP EX; destruct EX as [i SCHED].
apply mem_bigcat_ord with (j := i); first by apply ltn_ord.
by move: SCHED => /eqP SCHED; rewrite SCHED /= mem_seq1 eq_refl.
}
......@@ -524,7 +516,8 @@ End Schedule.
(* Specific properties of a schedule of sporadic jobs. *)
Module ScheduleOfSporadicTask.
Import SporadicTask Job Schedule.
Import SporadicTask Job.
Export Schedule.
Section ScheduledJobs.
......@@ -540,11 +533,21 @@ Module ScheduleOfSporadicTask.
(* Given a task tsk, ...*)
Variable tsk: sporadic_task.
(* ..., we define the list of jobs scheduled during [t1, t2). *)
(* ..., we we can state that tsk is scheduled on cpu at time t as follows. *)
Definition task_scheduled_on (cpu: processor num_cpus) (t: time) :=
if (sched cpu t) is Some j then
(job_task j == tsk)
else false.
(* Likewise, we can state that tsk is scheduled on some processor. *)
Definition task_is_scheduled (t: time) :=
[exists cpu, task_scheduled_on cpu t].
(* We also define the list of jobs scheduled during [t1, t2). *)
Definition jobs_of_task_scheduled_between (t1 t2: time) :=
filter (fun (j: JobIn arr_seq) => job_task j == tsk)
(jobs_scheduled_between sched t1 t2).
End ScheduledJobs.
Section ScheduleProperties.
......
This diff is collapsed.
......@@ -39,20 +39,30 @@ Module InterferenceEDF.
rename H_scheduler_uses_EDF into PRIO.
intros j j' t1 t2 INTERF.
unfold job_interference in INTERF.
destruct ([exists t': 'I_t2, (t' >= t1) && backlogged job_cost job_jitter sched j' t' &&
scheduled sched j t']) eqn:EX.
destruct ([exists t': 'I_t2,
[exists cpu: processor num_cpus,
(t' >= t1) &&
backlogged job_cost job_jitter sched j' t' &&
scheduled_on sched j cpu t']]) eqn:EX.
{
move: EX => /existsP EX; destruct EX as [t' EX];move: EX => /andP [/andP [LE BACK] SCHED].
by eapply PRIO in SCHED; last by apply BACK.
move: EX => /existsP [t' /existsP [cpu /andP [/andP [LE BACK] SCHED]]].
apply PRIO with (t := t'); first by done.
by apply/existsP; exists cpu.
}
{
apply negbT in EX; rewrite negb_exists in EX; move: EX => /forallP ALL.
apply negbT in EX; rewrite negb_exists in EX; move: EX => /forallP ALL.
rewrite big_nat_cond (eq_bigr (fun x => 0)) in INTERF;
first by rewrite -big_nat_cond big_const_nat iter_addn mul0n addn0 eq_refl in INTERF.
intros i; rewrite andbT; move => /andP [GT LT].
specialize (ALL (Ordinal LT)); simpl in ALL.
rewrite -andbA negb_and -implybE in ALL; move: ALL => /implyP ALL.
by specialize (ALL GT); apply/eqP; rewrite eqb0.
move => i /andP [/andP [GEi LTi] _].
specialize (ALL (Ordinal LTi)).
rewrite negb_exists in ALL.
move: ALL => /forallP ALL.
rewrite (eq_bigr (fun x => 0));
first by rewrite big_const_ord iter_addn mul0n addn0.
intros cpu _; specialize (ALL cpu); simpl in ALL.
destruct (backlogged job_cost job_jitter sched j' i); last by rewrite andFb.
rewrite GEi 2!andTb in ALL; rewrite andTb.
by apply negbTE in ALL; rewrite ALL.
}
Qed.
......
......@@ -6,7 +6,7 @@ Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq fintype bigop.
Module Platform.
Import Job SporadicTaskset ScheduleWithJitter ScheduleOfSporadicTask SporadicTaskset SporadicTaskArrival Interference Priority.
Import Job SporadicTaskset ScheduleOfSporadicTaskWithJitter SporadicTaskset SporadicTaskArrival Interference Priority.
Section SchedulingInvariants.
......@@ -281,7 +281,6 @@ Module Platform.
apply count_exists; first by done.
{
intros cpu x1 x2 SCHED1 SCHED2.
unfold schedules_job_of_tsk in *.
destruct (sched cpu t); last by done.
move: SCHED1 SCHED2 => /eqP SCHED1 /eqP SCHED2.
by rewrite -SCHED1 -SCHED2.
......@@ -309,9 +308,8 @@ Module Platform.
rewrite mem_scheduled_jobs_eq_scheduled in SCHED'.
unfold scheduled_task_other_than; apply/andP; split.
{
move: SCHED' => /exists_inP [cpu INcpu /eqP SCHED'].
apply/exists_inP; exists cpu; first by done.
by unfold schedules_job_of_tsk; rewrite SCHED' eq_refl.
move: SCHED' => /existsP [cpu /eqP SCHED'].
by apply/existsP; exists cpu; rewrite /task_scheduled_on SCHED' eq_refl.
}
{
apply/eqP; red; intro SAMEtsk; symmetry in SAMEtsk.
......
......@@ -7,7 +7,7 @@ Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq fintype bigop.
Module PlatformFP.
Import Job SporadicTaskset ScheduleWithJitter ScheduleOfSporadicTask SporadicTaskset
Import Job SporadicTaskset ScheduleOfSporadicTaskWithJitter SporadicTaskset
SporadicTaskArrival Interference Priority Platform.
Section Lemmas.
......@@ -217,7 +217,6 @@ Module PlatformFP.
apply count_exists; first by done.
{
intros cpu x1 x2 SCHED1 SCHED2.
unfold schedules_job_of_tsk in *.
destruct (sched cpu t); last by done.
move: SCHED1 SCHED2 => /eqP SCHED1 /eqP SCHED2.
by rewrite -SCHED1 -SCHED2.
......@@ -261,9 +260,8 @@ Module PlatformFP.
rewrite mem_scheduled_jobs_eq_scheduled in SCHED'.
apply/andP; split.
{
move: SCHED' => /exists_inP [cpu INcpu /eqP SCHED'].
apply/exists_inP; exists cpu; first by done.
by unfold schedules_job_of_tsk; rewrite SCHED' eq_refl.
move: SCHED' => /existsP [cpu /eqP SCHED'].
by apply/existsP; exists cpu; rewrite /task_scheduled_on SCHED' eq_refl.
}
apply/andP; split; first by rewrite -JOBtsk; apply PRIO with (t := t).
{
......
......@@ -146,10 +146,110 @@ Module ScheduleWithJitter.
End ScheduleWithJitter.
Module ScheduleOfSporadicTask.
(* Specific properties of a schedule of sporadic jobs. *)
Module ScheduleOfSporadicTaskWithJitter.
Import SporadicTask Job.
Export ScheduleWithJitter.
Section ScheduledJobs.
Context {sporadic_task: eqType}.
Context {Job: eqType}.
Variable job_task: Job -> sporadic_task.
(* Consider any schedule. *)
Context {arr_seq: arrival_sequence Job}.
Context {num_cpus: nat}.
Variable sched: schedule num_cpus arr_seq.
(* Given a task tsk, ...*)
Variable tsk: sporadic_task.
(* ..., we we can state that tsk is scheduled on cpu at time t as follows. *)
Definition task_scheduled_on (cpu: processor num_cpus) (t: time) :=
if (sched cpu t) is Some j then
(job_task j == tsk)
else false.
(* Likewise, we can state that tsk is scheduled on some processor. *)
Definition task_is_scheduled (t: time) :=
[exists cpu, task_scheduled_on cpu t].
(* We also define the list of jobs scheduled during [t1, t2). *)
Definition jobs_of_task_scheduled_between (t1 t2: time) :=
filter (fun (j: JobIn arr_seq) => job_task j == tsk)
(jobs_scheduled_between sched t1 t2).
End ScheduledJobs.
(* The model for sporadic tasks can be safely imported. *)
Require Import rt.model.basic.schedule.
Export ScheduleOfSporadicTask.
Section ScheduleProperties.
Context {sporadic_task: eqType}.
Context {Job: eqType}.
Variable job_cost: Job -> time.
Variable job_jitter: Job -> time.
Variable job_task: Job -> sporadic_task.
(* Consider any schedule. *)
Context {arr_seq: arrival_sequence Job}.
Context {num_cpus: nat}.
Variable sched: schedule num_cpus arr_seq.
(* Next we define intra-task parallelism, ... *)
Definition jobs_of_same_task_dont_execute_in_parallel :=
forall (j j': JobIn arr_seq) t,
job_task j = job_task j' ->
scheduled sched j t -> scheduled sched j' t -> j = j'.
(* ... and task precedence constraints. *)
Definition task_precedence_constraints :=
forall (j j': JobIn arr_seq) t,
job_task j = job_task j' ->
job_arrival j < job_arrival j' ->
pending job_cost job_jitter sched j t -> ~~ scheduled sched j' t.
End ScheduleProperties.
Section BasicLemmas.
(* Assume the job cost and task are known. *)
Context {sporadic_task: eqType}.
Variable task_cost: sporadic_task -> time.
Variable task_deadline: sporadic_task -> time.
Context {Job: eqType}.
Variable job_cost: Job -> time.
Variable job_deadline: Job -> time.
Variable job_task: Job -> sporadic_task.
End ScheduleOfSporadicTask.
\ No newline at end of file
(* Then, in a valid schedule of sporadic tasks ...*)
Context {arr_seq: arrival_sequence Job}.
Context {num_cpus: nat}.
Variable sched: schedule num_cpus arr_seq.
(* ...such that jobs do not execute after completion, ...*)
Hypothesis jobs_dont_execute_after_completion :
completed_jobs_dont_execute job_cost sched.
Variable tsk: sporadic_task.
Variable j: JobIn arr_seq.
Hypothesis H_job_of_task: job_task j = tsk.
Hypothesis valid_job:
valid_sporadic_job task_cost task_deadline job_cost job_deadline job_task j.
(* Remember that for any job of tsk, service <= task_cost tsk *)
Lemma cumulative_service_le_task_cost :
forall t t',
service_during sched j t t' <= task_cost tsk.
Proof.
rename valid_job into VALID; unfold valid_sporadic_job in *; ins; des.
apply leq_trans with (n := job_cost j);
last by rewrite -H_job_of_task; apply VALID0.
by apply cumulative_service_le_job_cost.
Qed.
End BasicLemmas.
End ScheduleOfSporadicTaskWithJitter.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment