Commit 96576ba4 authored by Felipe Cerqueira's avatar Felipe Cerqueira

Reorganizing platform/interference files

parent e54b7a37
This diff is collapsed.
......@@ -54,22 +54,15 @@ Module ResponseTimeAnalysisEDF.
Section AllTasks.
Definition is_interfering_task_jlfp (tsk_other: sporadic_task) :=
tsk_other != tsk.
Let interferes_with_tsk := is_interfering_task_jlfp tsk.
(* The total interference incurred by tsk is thus bounded by: *)
Definition total_interference_bound_edf :=
\sum_((tsk_other, R_other) <- R_prev | is_interfering_task_jlfp tsk_other)
\sum_((tsk_other, R_other) <- R_prev | interferes_with_tsk tsk_other)
interference_bound_edf (tsk_other, R_other).
End AllTasks.
Section Proofs.
(* Proof of edf-specific bound should go here *)
End Proofs.
End InterferenceBoundEDF.
Section ResponseTimeBound.
......@@ -157,19 +150,14 @@ Module ResponseTimeAnalysisEDF.
(tsk_other, R) \in rt_bounds -> R <= task_deadline tsk_other.
(* Assume that the schedule satisfies the global scheduling
invariant, i.e., if any job of tsk is backlogged, all
the processors must be busy with jobs of equal or higher
priority. *)
invariant with EDF priority, i.e., if any job of tsk is
backlogged, every processor must be busy with jobs with
no greater absolute deadline. *)
Let higher_eq_priority :=
@EDF Job arr_seq job_deadline. (* TODO: implicit params seems broken *)
Hypothesis H_global_scheduling_invariant:
forall (tsk: sporadic_task) (j: JobIn arr_seq) (t: time),
tsk \in ts ->
job_task j = tsk ->
backlogged job_cost rate sched j t ->
count
(fun tsk_other : sporadic_task =>
is_interfering_task_jlfp tsk tsk_other &&
task_is_scheduled job_task sched tsk_other t) ts = num_cpus.
JLFP_JLDP_scheduling_invariant_holds job_cost num_cpus rate sched higher_eq_priority.
(* Next, we define Bertogna and Cirinei's response-time bound recurrence *)
Variable tsk: sporadic_task.
......@@ -378,7 +366,9 @@ Module ResponseTimeAnalysisEDF.
destruct ([exists t': 'I_t2, (t' >= t1) && backlogged job_cost rate 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].
admit. (* Use INVARIANT -- needs some fix for EDF *)
eapply interfering_job_has_higher_eq_prio in BACK;
[ | by apply INVARIANT | by apply SCHED].
by apply BACK.
}
{
apply negbT in EX; rewrite negb_exists in EX; move: EX => /forallP ALL.
......
This diff is collapsed.
......@@ -14,7 +14,7 @@
#
# This Makefile was generated by the command line :
# coq_makefile BertognaResponseTimeDefsEDF.v BertognaResponseTimeDefsJitter.v BertognaResponseTimeDefs.v BertognaResponseTimeEDFComp.v BertognaResponseTimeFPJitter.v BertognaResponseTimeFP.v divround.v extralib.v ExtraRelations.v GuanDefs.v GuanFP.v helper.v JobDefs.v PlatformDefs.v PriorityDefs.v ResponseTimeDefs.v SchedulabilityDefs.v ScheduleDefs.v ssromega.v TaskArrivalDefs.v TaskDefs.v Vbase.v WorkloadDefsJitter.v WorkloadDefs.v
# coq_makefile BertognaResponseTimeDefsEDF.v BertognaResponseTimeDefsJitter.v BertognaResponseTimeDefs.v BertognaResponseTimeEDFComp.v BertognaResponseTimeFPJitter.v BertognaResponseTimeFP.v divround.v extralib.v ExtraRelations.v GuanDefs.v GuanFP.v helper.v InterferenceDefs.v JobDefs.v PlatformDefs.v PriorityDefs.v ResponseTimeDefs.v SchedulabilityDefs.v ScheduleDefs.v ssromega.v TaskArrivalDefs.v TaskDefs.v Vbase.v WorkloadDefsJitter.v WorkloadDefs.v
#
.DEFAULT_GOAL := all
......@@ -92,6 +92,7 @@ VFILES:=BertognaResponseTimeDefsEDF.v\
GuanDefs.v\
GuanFP.v\
helper.v\
InterferenceDefs.v\
JobDefs.v\
PlatformDefs.v\
PriorityDefs.v\
......
Require Import Vbase ScheduleDefs JobDefs PriorityDefs TaskArrivalDefs
ssreflect ssrbool eqtype ssrnat seq.
(*Module Platform.
Import Schedule.
(* A processor platform is simply a set of schedules, \ie.,
it specifies the amount of service that jobs receive over time. *)
Definition processor_platform := schedule_mapping -> Prop.
(* For a processor platform to be valid, it must be able to schedule
any possible job arrival sequence. In particular, the constraints
of the platform should not be trivially false. *)
(*Definition valid_platform (plat: processor_platform) :=
exists (sched: schedule), plat sched.*)
(* Whether a job receives at most 1 unit of service *)
Definition max_service_one (sched: schedule) := forall j t, service_at sched j t <= 1.
End Platform.
Module IdenticalMultiprocessor.
Import Job ScheduleOfSporadicTask Platform Priority SporadicTaskArrival.
Section Multiprocessor.
Variable num_cpus: nat.
Variable higher_eq_priority: jldp_policy.
Variable sched: schedule.
(* There is at least one processor. *)
Definition mp_cpus_nonzero := num_cpus > 0.
(* At any time,
(a) processors never stay idle when there are pending jobs (work conservation), and,
(b) the number of scheduled jobs does not exceed the number of processors. *)
Definition mp_work_conserving :=
forall t, num_scheduled_jobs sched t = minn (num_pending_jobs sched t) num_cpus.
(* If a job is backlogged, then either:
(a) there exists an earlier pending job of the same task
(b) all processor are busy with (other) jobs with higher or equal priority. *)
Definition mp_scheduling_invariant :=
forall jlow t (ARRIVED: jlow \in prev_arrivals sched t)
(BACK: backlogged sched jlow t),
exists_earlier_job sched t jlow \/
num_interfering_jobs higher_eq_priority sched t jlow = num_cpus.
Definition identical_multiprocessor :=
mp_cpus_nonzero /\ mp_scheduling_invariant /\ mp_work_conserving.
End Multiprocessor.
Section Uniprocessor.
(* Uniprocessor is a special case of a multiprocessor *)
Definition uniprocessor := identical_multiprocessor 1.
End Uniprocessor.
(*Lemma identmp_valid :
forall num_cpus higher_eq_priority,
valid_platform (identical_multiprocessor num_cpus higher_eq_priority).
Proof.
unfold valid_platform, identical_multiprocessor, mp_cpus_nonzero,
mp_scheduling_invariant; ins.
Qed.*)
End IdenticalMultiprocessor. *)
\ No newline at end of file
Require Import Vbase TaskDefs ScheduleDefs JobDefs PriorityDefs
InterferenceDefs helper
ssreflect ssrbool eqtype ssrnat seq fintype.
Module Platform.
Import Schedule SporadicTaskset Interference Priority.
Section SchedulingInvariants.
Context {sporadic_task: eqType}.
Variable task_cost: sporadic_task -> nat.
Variable task_period: sporadic_task -> nat.
Variable task_deadline: sporadic_task -> nat.
Context {Job: eqType}.
Variable job_cost: Job -> nat.
Variable job_deadline: Job -> nat.
Variable job_task: Job -> sporadic_task.
(* Assume any job arrival sequence... *)
Context {arr_seq: arrival_sequence Job}.
(* Consider any schedule such that...*)
Variable num_cpus: nat.
Variable rate: Job -> processor num_cpus -> nat.
Variable sched: schedule num_cpus arr_seq.
(* Assume that we have a task set where all tasks have valid
parameters and restricted deadlines. *)
Variable ts: taskset_of sporadic_task.
Section FP.
(* Given an FP policy, ...*)
Variable higher_eq_priority: fp_policy sporadic_task.
(* the global scheduling invariant states that if a job is
backlogged, then all the processors are busy with jobs
of higher-priority tasks. *)
Definition FP_scheduling_invariant_holds :=
forall (tsk: sporadic_task) (j: JobIn arr_seq) (t: time),
tsk \in ts ->
job_task j = tsk ->
backlogged job_cost rate sched j t ->
count
(fun tsk_other : sporadic_task =>
is_interfering_task_fp higher_eq_priority tsk tsk_other &&
task_is_scheduled job_task sched tsk_other t) ts = num_cpus.
End FP.
Section JLDP.
(* Given a JLFP/JLDP policy, ...*)
Variable higher_eq_priority: jldp_policy arr_seq.
(* ... the global scheduling invariant states that at any time t,
if a job J is backlogged, then all processors are busy with
jobs of higher-priority. *)
Definition JLFP_JLDP_scheduling_invariant_holds :=
forall (j: JobIn arr_seq) (t: time),
backlogged job_cost rate sched j t ->
count
(fun j_other => higher_eq_priority t j_other j)
(jobs_scheduled_at sched t)
= num_cpus.
Section BasicLemmas.
Hypothesis H_invariant_holds :
JLFP_JLDP_scheduling_invariant_holds.
Lemma interfering_job_has_higher_eq_prio :
forall j j_other t,
backlogged job_cost rate sched j t ->
scheduled sched j_other t ->
higher_eq_priority t j_other j.
Proof.
intros j j_other t BACK SCHED.
exploit H_invariant_holds; [by apply BACK | intro COUNT].
destruct (higher_eq_priority t j_other j) eqn:LOW; first by done.
apply negbT in LOW.
generalize SCHED; unfold scheduled in SCHED; intro SCHED'.
move: SCHED => /existsP EX; destruct EX as [cpu H].
move: H => /andP [_ /eqP SCHED].
assert (ATMOST: size (jobs_scheduled_at sched t) <= num_cpus).
{
apply size_bigcat_ord; [by apply cpu|].
by ins; unfold make_sequence; destruct (sched x t).
}
rewrite -(count_predC (fun j_other => higher_eq_priority t j_other j)) COUNT in ATMOST.
assert (BUG: num_cpus < num_cpus).
{
apply leq_trans with (n := num_cpus + count (predC (fun j_other => higher_eq_priority t j_other j)) (jobs_scheduled_at sched t));
last by done.
rewrite -{1}[num_cpus]addn0 ltn_add2l -has_count.
apply/hasP; exists j_other; last by done.
unfold jobs_scheduled_at.
apply mem_bigcat_ord with (j := cpu);
first by apply ltn_ord.
by unfold make_sequence; rewrite SCHED mem_seq1 eq_refl.
}
by rewrite ltnn in BUG.
Qed.
Lemma cpus_busy_with_interfering_tasks :
forall (j: JobIn arr_seq) tsk t,
job_task j = tsk ->
backlogged job_cost rate sched j t ->
count
(fun j : sporadic_task =>
is_interfering_task_jlfp tsk j &&
task_is_scheduled job_task sched j t)
ts = num_cpus.
Proof.
admit.
Qed.
End BasicLemmas.
End JLDP.
End SchedulingInvariants.
End Platform.
\ No newline at end of file
......@@ -153,8 +153,7 @@ Module Priority.
Section EDFDefs.
Context {Job: eqType}.
Context {num_cpus: nat}.
Context {arr_seq: arrival_sequence Job}.
Variable arr_seq: arrival_sequence Job.
Variable job_deadline: Job -> nat.
Definition EDF (t: time) (j1 j2: JobIn arr_seq) :=
......@@ -179,55 +178,4 @@ Module Priority.
End EDFDefs.
(*Section ScheduleIndependent.
Context {Job: eqType}.
Context {num_cpus: nat}.
Context {arr_seq: arrival_sequence Job}.
(* Whether a priority order is schedule-independent *)
Definition schedule_independent (hp: jldp_policy num_cpus arr_seq) :=
forall (sched1 sched2: schedule num_cpus arr_seq),
hp sched1 = hp sched2.
Variable job_deadline: Job -> nat.
Lemma edf_schedule_independent : schedule_independent (EDF job_deadline).
Proof.
by unfold schedule_independent, EDF; ins.
Qed.
Variable job_task: Job -> sporadic_task.
Lemma fp_schedule_independent :
forall task_hp,
schedule_independent (fp_to_jldp job_task task_hp).
Proof.
by unfold schedule_independent, fp_to_jldp.
Qed.
End ScheduleIndependent.*)
End Priority.
(*Section BasicDefinitions.
Variable higher_eq_priority: jldp_policy.
Variable sched: schedule.
Variable t: time.
Definition num_pending_jobs :=
count (fun j => pending sched j t) (all_arrivals sched t).
Definition num_scheduled_jobs :=
count (fun j => scheduled sched j t) (all_arrivals sched t).
(* Whether a job jhigh can preempt jlow at time t *)
Definition interferes_with (jlow jhigh: job) :=
scheduled sched jhigh t &&
higher_eq_priority sched t jhigh jlow &&
(jhigh != jlow).
Definition num_interfering_jobs (jlow: job) :=
count (interferes_with jlow) (all_arrivals sched t).
End BasicDefinitions.*)
\ No newline at end of file
End Priority.
\ No newline at end of file
Require Import Vbase TaskDefs JobDefs TaskArrivalDefs ScheduleDefs
PlatformDefs helper
ssreflect ssrbool eqtype ssrnat seq fintype bigop.
helper ssreflect ssrbool eqtype ssrnat seq fintype bigop.
Module ResponseTime.
......
......@@ -150,6 +150,14 @@ Module Schedule.
(* A carried-out job in [t1,t2) arrives after t1 and is not completed at time t2 *)
Definition carried_out (t1 t2: time) := arrived_between j t1 t2 && ~~ completed t2.
(* The list of jobs scheduled at time t. *)
Definition jobs_scheduled_at (t: time) :=
\cat_(cpu < num_cpus) make_sequence (sched cpu t).
(* The (duplicate-free) list of jobs scheduled in the interval [t1, t2). *)
Definition jobs_scheduled_between (t1 t2: time) :=
undup (\cat_(t1 <= t < t2) jobs_scheduled_at t).
End ScheduledJobs.
Section ValidSchedules.
......
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