Commit ac6f0d4e authored by Felipe Cerqueira's avatar Felipe Cerqueira

Major commit: Uniprocessor RTA

This commit contains several updates related to uniprocessor scheduling.

- Basic definitions of uniprocessor scheduling (see model/uni)
- Definitions of worload and service for generic sets of jobs (see service.v and workload.v in model/uni)
- Definitions and lemmas about busy intervals (see model/uni/basic/busy_interval.v)
- Definition of an arrival bound for sporadic tasks (see model/arrival_bounds.v)
- Definitions and correctness proofs of the RTA for FP scheduling
  (also works with non-unique priorities and arbitrary deadlines, but gives pessimistic bounds)
- Implementation of the FP RTA to check for contradictory assumptions

In addition, we have also defined partitioned scheduling and proven how it relates
with uniprocessor (see model/partitioned).
parent 5d02df7f
......@@ -14,7 +14,7 @@
#
# This Makefile was generated by the command line :
# coq_makefile -f _CoqProject ./util/ssromega.v ./util/seqset.v ./util/sorting.v ./util/powerset.v ./util/all.v ./util/ord_quantifier.v ./util/nat.v ./util/sum.v ./util/bigord.v ./util/counting.v ./util/tactics.v ./util/induction.v ./util/list.v ./util/divround.v ./util/bigcat.v ./util/fixedpoint.v ./util/notation.v ./analysis/global/jitter/bertogna_fp_comp.v ./analysis/global/jitter/interference_bound_edf.v ./analysis/global/jitter/workload_bound.v ./analysis/global/jitter/bertogna_edf_comp.v ./analysis/global/jitter/bertogna_fp_theory.v ./analysis/global/jitter/interference_bound.v ./analysis/global/jitter/interference_bound_fp.v ./analysis/global/jitter/bertogna_edf_theory.v ./analysis/global/parallel/bertogna_fp_comp.v ./analysis/global/parallel/interference_bound_edf.v ./analysis/global/parallel/workload_bound.v ./analysis/global/parallel/bertogna_edf_comp.v ./analysis/global/parallel/bertogna_fp_theory.v ./analysis/global/parallel/interference_bound.v ./analysis/global/parallel/interference_bound_fp.v ./analysis/global/parallel/bertogna_edf_theory.v ./analysis/global/basic/bertogna_fp_comp.v ./analysis/global/basic/interference_bound_edf.v ./analysis/global/basic/workload_bound.v ./analysis/global/basic/bertogna_edf_comp.v ./analysis/global/basic/bertogna_fp_theory.v ./analysis/global/basic/interference_bound.v ./analysis/global/basic/interference_bound_fp.v ./analysis/global/basic/bertogna_edf_theory.v ./analysis/apa/bertogna_fp_comp.v ./analysis/apa/interference_bound_edf.v ./analysis/apa/workload_bound.v ./analysis/apa/bertogna_edf_comp.v ./analysis/apa/bertogna_fp_theory.v ./analysis/apa/interference_bound.v ./analysis/apa/interference_bound_fp.v ./analysis/apa/bertogna_edf_theory.v ./model/arrival_sequence.v ./model/task.v ./model/task_arrival.v ./model/priority.v ./model/global/workload.v ./model/global/schedulability.v ./model/global/jitter/interference_edf.v ./model/global/jitter/interference.v ./model/global/jitter/job.v ./model/global/jitter/constrained_deadlines.v ./model/global/jitter/schedule.v ./model/global/jitter/platform.v ./model/global/response_time.v ./model/global/basic/interference_edf.v ./model/global/basic/interference.v ./model/global/basic/constrained_deadlines.v ./model/global/basic/schedule.v ./model/global/basic/platform.v ./model/job.v ./model/time.v ./model/apa/interference_edf.v ./model/apa/interference.v ./model/apa/affinity.v ./model/apa/constrained_deadlines.v ./model/apa/platform.v ./implementation/global/jitter/arrival_sequence.v ./implementation/global/jitter/task.v ./implementation/global/jitter/bertogna_edf_example.v ./implementation/global/jitter/job.v ./implementation/global/jitter/bertogna_fp_example.v ./implementation/global/jitter/schedule.v ./implementation/global/parallel/arrival_sequence.v ./implementation/global/parallel/task.v ./implementation/global/parallel/bertogna_edf_example.v ./implementation/global/parallel/job.v ./implementation/global/parallel/bertogna_fp_example.v ./implementation/global/parallel/schedule.v ./implementation/global/basic/arrival_sequence.v ./implementation/global/basic/task.v ./implementation/global/basic/bertogna_edf_example.v ./implementation/global/basic/job.v ./implementation/global/basic/bertogna_fp_example.v ./implementation/global/basic/schedule.v ./implementation/apa/arrival_sequence.v ./implementation/apa/task.v ./implementation/apa/bertogna_edf_example.v ./implementation/apa/job.v ./implementation/apa/bertogna_fp_example.v ./implementation/apa/schedule.v -o Makefile
# coq_makefile -f _CoqProject ./util/ssromega.v ./util/seqset.v ./util/sorting.v ./util/powerset.v ./util/all.v ./util/ord_quantifier.v ./util/nat.v ./util/sum.v ./util/bigord.v ./util/counting.v ./util/tactics.v ./util/induction.v ./util/list.v ./util/divround.v ./util/bigcat.v ./util/fixedpoint.v ./util/notation.v ./analysis/global/jitter/bertogna_fp_comp.v ./analysis/global/jitter/interference_bound_edf.v ./analysis/global/jitter/workload_bound.v ./analysis/global/jitter/bertogna_edf_comp.v ./analysis/global/jitter/bertogna_fp_theory.v ./analysis/global/jitter/interference_bound.v ./analysis/global/jitter/interference_bound_fp.v ./analysis/global/jitter/bertogna_edf_theory.v ./analysis/global/parallel/bertogna_fp_comp.v ./analysis/global/parallel/interference_bound_edf.v ./analysis/global/parallel/workload_bound.v ./analysis/global/parallel/bertogna_edf_comp.v ./analysis/global/parallel/bertogna_fp_theory.v ./analysis/global/parallel/interference_bound.v ./analysis/global/parallel/interference_bound_fp.v ./analysis/global/parallel/bertogna_edf_theory.v ./analysis/global/basic/bertogna_fp_comp.v ./analysis/global/basic/interference_bound_edf.v ./analysis/global/basic/workload_bound.v ./analysis/global/basic/bertogna_edf_comp.v ./analysis/global/basic/bertogna_fp_theory.v ./analysis/global/basic/interference_bound.v ./analysis/global/basic/interference_bound_fp.v ./analysis/global/basic/bertogna_edf_theory.v ./analysis/apa/bertogna_fp_comp.v ./analysis/apa/interference_bound_edf.v ./analysis/apa/workload_bound.v ./analysis/apa/bertogna_edf_comp.v ./analysis/apa/bertogna_fp_theory.v ./analysis/apa/interference_bound.v ./analysis/apa/interference_bound_fp.v ./analysis/apa/bertogna_edf_theory.v ./analysis/uni/basic/workload_bound_fp.v ./analysis/uni/basic/fp_rta_comp.v ./analysis/uni/basic/fp_rta_theory.v ./model/arrival_sequence.v ./model/task.v ./model/task_arrival.v ./model/partitioned/schedulability.v ./model/partitioned/schedule.v ./model/priority.v ./model/global/workload.v ./model/global/schedulability.v ./model/global/jitter/interference_edf.v ./model/global/jitter/interference.v ./model/global/jitter/job.v ./model/global/jitter/constrained_deadlines.v ./model/global/jitter/schedule.v ./model/global/jitter/platform.v ./model/global/response_time.v ./model/global/basic/interference_edf.v ./model/global/basic/interference.v ./model/global/basic/constrained_deadlines.v ./model/global/basic/schedule.v ./model/global/basic/platform.v ./model/job.v ./model/time.v ./model/arrival_bounds.v ./model/apa/interference_edf.v ./model/apa/interference.v ./model/apa/affinity.v ./model/apa/constrained_deadlines.v ./model/apa/platform.v ./model/uni/workload.v ./model/uni/schedulability.v ./model/uni/schedule_of_task.v ./model/uni/response_time.v ./model/uni/schedule.v ./model/uni/basic/arrival_bounds.v ./model/uni/basic/busy_interval.v ./model/uni/basic/platform.v ./model/uni/service.v ./implementation/arrival_sequence.v ./implementation/task.v ./implementation/global/jitter/arrival_sequence.v ./implementation/global/jitter/task.v ./implementation/global/jitter/bertogna_edf_example.v ./implementation/global/jitter/job.v ./implementation/global/jitter/bertogna_fp_example.v ./implementation/global/jitter/schedule.v ./implementation/global/parallel/bertogna_edf_example.v ./implementation/global/parallel/bertogna_fp_example.v ./implementation/global/basic/bertogna_edf_example.v ./implementation/global/basic/bertogna_fp_example.v ./implementation/global/basic/schedule.v ./implementation/job.v ./implementation/apa/arrival_sequence.v ./implementation/apa/task.v ./implementation/apa/bertogna_edf_example.v ./implementation/apa/job.v ./implementation/apa/bertogna_fp_example.v ./implementation/apa/schedule.v ./implementation/uni/basic/fp_rta_example.v ./implementation/uni/basic/schedule.v -o Makefile
#
.DEFAULT_GOAL := all
......@@ -143,9 +143,14 @@ VFILES:=util/ssromega.v\
analysis/apa/interference_bound.v\
analysis/apa/interference_bound_fp.v\
analysis/apa/bertogna_edf_theory.v\
analysis/uni/basic/workload_bound_fp.v\
analysis/uni/basic/fp_rta_comp.v\
analysis/uni/basic/fp_rta_theory.v\
model/arrival_sequence.v\
model/task.v\
model/task_arrival.v\
model/partitioned/schedulability.v\
model/partitioned/schedule.v\
model/priority.v\
model/global/workload.v\
model/global/schedulability.v\
......@@ -163,35 +168,43 @@ VFILES:=util/ssromega.v\
model/global/basic/platform.v\
model/job.v\
model/time.v\
model/arrival_bounds.v\
model/apa/interference_edf.v\
model/apa/interference.v\
model/apa/affinity.v\
model/apa/constrained_deadlines.v\
model/apa/platform.v\
model/uni/workload.v\
model/uni/schedulability.v\
model/uni/schedule_of_task.v\
model/uni/response_time.v\
model/uni/schedule.v\
model/uni/basic/arrival_bounds.v\
model/uni/basic/busy_interval.v\
model/uni/basic/platform.v\
model/uni/service.v\
implementation/arrival_sequence.v\
implementation/task.v\
implementation/global/jitter/arrival_sequence.v\
implementation/global/jitter/task.v\
implementation/global/jitter/bertogna_edf_example.v\
implementation/global/jitter/job.v\
implementation/global/jitter/bertogna_fp_example.v\
implementation/global/jitter/schedule.v\
implementation/global/parallel/arrival_sequence.v\
implementation/global/parallel/task.v\
implementation/global/parallel/bertogna_edf_example.v\
implementation/global/parallel/job.v\
implementation/global/parallel/bertogna_fp_example.v\
implementation/global/parallel/schedule.v\
implementation/global/basic/arrival_sequence.v\
implementation/global/basic/task.v\
implementation/global/basic/bertogna_edf_example.v\
implementation/global/basic/job.v\
implementation/global/basic/bertogna_fp_example.v\
implementation/global/basic/schedule.v\
implementation/job.v\
implementation/apa/arrival_sequence.v\
implementation/apa/task.v\
implementation/apa/bertogna_edf_example.v\
implementation/apa/job.v\
implementation/apa/bertogna_fp_example.v\
implementation/apa/schedule.v
implementation/apa/schedule.v\
implementation/uni/basic/fp_rta_example.v\
implementation/uni/basic/schedule.v
ifneq ($(filter-out archclean clean cleanall printenv,$(MAKECMDGOALS)),)
-include $(addsuffix .d,$(VFILES))
......
......@@ -11,7 +11,7 @@ From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop d
Module ResponseTimeAnalysisEDF.
Export Job SporadicTaskset ScheduleOfSporadicTask Workload Schedulability ResponseTime
Priority SporadicTaskArrival WorkloadBound InterferenceBoundEDF
Priority TaskArrival WorkloadBound InterferenceBoundEDF
Interference Platform Affinity ConstrainedDeadlines.
(* In this section, we prove that any fixed point in the APA-reduction of
......
......@@ -13,7 +13,7 @@ Module ResponseTimeAnalysisFP.
Export Job SporadicTaskset ScheduleOfSporadicTask Workload Interference InterferenceBoundFP
Platform Schedulability ResponseTime Priority
SporadicTaskArrival WorkloadBound Affinity ConstrainedDeadlines.
TaskArrival WorkloadBound Affinity ConstrainedDeadlines.
(* In this section, we prove that any fixed point in the APA-reduction of Bertogna
and Cirinei's RTA for FP scheduling with slack updates is a safe response-time
......
......@@ -14,7 +14,7 @@ Module InterferenceBoundEDF.
Import Job SporadicTaskset Schedule ScheduleOfSporadicTask Schedulability
WorkloadBound ResponseTime Priority Affinity
SporadicTaskArrival Interference InterferenceEDF.
TaskArrival Interference InterferenceEDF.
Export InterferenceBoundGeneric.
(* First we define Bertogna and Cirinei's EDF-specific interference bound. *)
......
......@@ -7,7 +7,7 @@ From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq div fintype big
Module WorkloadBound.
Import Job SporadicTaskset Schedule ScheduleOfSporadicTask SporadicTaskArrival ResponseTime Schedulability Workload.
Import Job SporadicTaskset Schedule ScheduleOfSporadicTask TaskArrival ResponseTime Schedulability Workload.
Section WorkloadBoundDef.
......
......@@ -11,7 +11,7 @@ From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop d
Module ResponseTimeAnalysisEDF.
Export Job SporadicTaskset Schedule ScheduleOfSporadicTask Workload Schedulability ResponseTime
Priority SporadicTaskArrival WorkloadBound InterferenceBoundEDF
Priority TaskArrival WorkloadBound InterferenceBoundEDF
Interference Platform ConstrainedDeadlines.
(* In this section, we prove that any fixed point in Bertogna and
......
......@@ -12,7 +12,7 @@ Module ResponseTimeAnalysisFP.
Export Job SporadicTaskset ScheduleOfSporadicTask Workload Interference
InterferenceBoundFP Platform Schedulability ResponseTime
Priority SporadicTaskArrival WorkloadBound ConstrainedDeadlines.
Priority TaskArrival WorkloadBound ConstrainedDeadlines.
(* In this section, we prove that any fixed point in Bertogna and
Cirinei's RTA for FP scheduling is a safe response-time bound.
......
......@@ -12,7 +12,7 @@ Module InterferenceBoundEDF.
Import Job SporadicTaskset Schedule ScheduleOfSporadicTask Schedulability
WorkloadBound ResponseTime Priority
SporadicTaskArrival Interference InterferenceEDF.
TaskArrival Interference InterferenceEDF.
Export InterferenceBoundGeneric.
(* In this section, we define Bertogna and Cirinei's EDF-specific
......
......@@ -7,7 +7,7 @@ From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq div fintype big
Module WorkloadBound.
Import Job SporadicTaskset Schedule ScheduleOfSporadicTask SporadicTaskArrival ResponseTime Schedulability Workload.
Import Job SporadicTaskset Schedule ScheduleOfSporadicTask TaskArrival ResponseTime Schedulability Workload.
Section WorkloadBoundDef.
......
......@@ -12,7 +12,7 @@ From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop d
Module ResponseTimeAnalysisEDFJitter.
Export JobWithJitter SporadicTaskset ScheduleOfSporadicTaskWithJitter Workload
Schedulability ResponseTime Priority SporadicTaskArrival WorkloadBoundJitter
Schedulability ResponseTime Priority TaskArrival WorkloadBoundJitter
InterferenceBoundEDFJitter Platform Interference ConstrainedDeadlines.
(* In this section, we prove that any fixed point in Bertogna and
......
......@@ -13,7 +13,7 @@ Module ResponseTimeAnalysisFP.
Export JobWithJitter SporadicTaskset ScheduleOfSporadicTaskWithJitter
Workload Interference Platform ConstrainedDeadlines Schedulability
ResponseTime Priority SporadicTaskArrival WorkloadBoundJitter
ResponseTime Priority TaskArrival WorkloadBoundJitter
Interference InterferenceBoundFP.
(* In this section, we prove that any fixed point in Bertogna and
......
......@@ -11,7 +11,7 @@ From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop d
Module InterferenceBoundEDFJitter.
Import JobWithJitter SporadicTaskset ScheduleWithJitter ScheduleOfSporadicTask Schedulability
ResponseTime WorkloadBoundJitter Priority SporadicTaskArrival Interference InterferenceEDF.
ResponseTime WorkloadBoundJitter Priority TaskArrival Interference InterferenceEDF.
Export InterferenceBoundJitter.
(* In this section, we define Bertogna and Cirinei's EDF-specific
......
......@@ -8,7 +8,7 @@ From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq div fintype big
Module WorkloadBoundJitter.
Import JobWithJitter SporadicTaskset ScheduleWithJitter ScheduleOfSporadicTask
SporadicTaskArrival ResponseTime Schedulability Workload.
TaskArrival ResponseTime Schedulability Workload.
Section WorkloadBoundJitterDef.
......
......@@ -11,7 +11,7 @@ From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop d
Module ResponseTimeAnalysisEDF.
Export Job SporadicTaskset Schedule ScheduleOfSporadicTask Workload Schedulability ResponseTime
Priority SporadicTaskArrival WorkloadBound InterferenceBoundEDF
Priority TaskArrival WorkloadBound InterferenceBoundEDF
Interference Platform.
(* In this section, we prove that any fixed point in Bertogna and
......
......@@ -12,7 +12,7 @@ Module ResponseTimeAnalysisFP.
Export Job SporadicTaskset ScheduleOfSporadicTask Workload Interference
InterferenceBoundFP Platform Schedulability ResponseTime
Priority SporadicTaskArrival WorkloadBound ConstrainedDeadlines.
Priority TaskArrival WorkloadBound ConstrainedDeadlines.
(* In this section, we prove that any fixed point in Bertogna and
Cirinei's RTA for FP scheduling modified to consider (potentially)
......
......@@ -12,7 +12,7 @@ Module InterferenceBoundEDF.
Import Job SporadicTaskset Schedule ScheduleOfSporadicTask Schedulability
WorkloadBound ResponseTime Priority
SporadicTaskArrival Interference InterferenceEDF.
TaskArrival Interference InterferenceEDF.
Export InterferenceBoundGeneric.
(* In this section, we define Bertogna and Cirinei's EDF-specific
......
......@@ -7,7 +7,7 @@ From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq div fintype big
Module WorkloadBound.
Import Job SporadicTaskset Schedule ScheduleOfSporadicTask SporadicTaskArrival ResponseTime Schedulability Workload.
Import Job SporadicTaskset Schedule ScheduleOfSporadicTask TaskArrival ResponseTime Schedulability Workload.
Section WorkloadBoundDef.
......
This diff is collapsed.
Require Import rt.util.all.
Require Import rt.model.job rt.model.task rt.model.priority rt.model.task_arrival
rt.model.arrival_bounds.
Require Import rt.model.uni.schedule_of_task rt.model.uni.workload
rt.model.uni.schedulability rt.model.uni.response_time
rt.model.uni.service.
Require Import rt.model.uni.basic.busy_interval rt.model.uni.basic.platform.
Require Import rt.analysis.uni.basic.workload_bound_fp.
From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop.
Module ResponseTimeAnalysisFP.
Import Job ScheduleOfTask SporadicTaskset Priority ResponseTime
TaskArrival ArrivalBounds WorkloadBoundFP Platform Schedulability
BusyInterval Workload Service.
(* In this section, we prove that any fixed point in the RTA for uniprocessor
FP scheduling is a response-time bound. *)
Section ResponseTimeBound.
Context {SporadicTask: eqType}.
Variable task_cost: SporadicTask -> time.
Variable task_period: SporadicTask -> time.
Variable task_deadline: SporadicTask -> time.
Context {Job: eqType}.
Variable job_cost: Job -> time.
Variable job_deadline: Job -> time.
Variable job_task: Job -> SporadicTask.
(* Assume any job arrival sequence without duplicates... *)
Context {arr_seq: arrival_sequence Job}.
Hypothesis H_no_duplicate_arrivals: arrival_sequence_is_a_set arr_seq.
(* ... in which jobs arrive sporadically and have valid parameters. *)
Hypothesis H_sporadic_tasks:
sporadic_task_model task_period arr_seq job_task.
Hypothesis H_valid_job_parameters:
forall (j: JobIn arr_seq),
valid_sporadic_job task_cost task_deadline job_cost job_deadline job_task j.
(* Consider a task set ts where all tasks have valid parameters... *)
Variable ts: seq SporadicTask.
Hypothesis H_valid_task_parameters:
valid_sporadic_taskset task_cost task_period task_deadline ts.
(* ... and assume that all jobs in the arrival sequence come from the task set. *)
Hypothesis H_all_jobs_from_taskset:
forall (j: JobIn arr_seq), job_task j \in ts.
(* Next, consider any uniprocessor schedule such that...*)
Variable sched: schedule arr_seq.
(* ...jobs do not execute before their arrival times nor longer than their
execution costs. *)
Hypothesis H_jobs_must_arrive_to_execute:
jobs_must_arrive_to_execute sched.
Hypothesis H_completed_jobs_dont_execute:
completed_jobs_dont_execute job_cost sched.
(* Consider an FP policy that indicates a higher-or-equal priority relation,
and assume that the relation is reflexive and transitive. *)
Variable higher_eq_priority: FP_policy SporadicTask.
Hypothesis H_priority_is_reflexive: FP_is_reflexive higher_eq_priority.
Hypothesis H_priority_is_transitive: FP_is_transitive higher_eq_priority.
(* Next, assume that the schedule is a work-conserving FP schedule. *)
Hypothesis H_work_conserving: work_conserving job_cost sched.
Hypothesis H_enforces_fp_policy: enforces_FP_policy job_cost job_task sched higher_eq_priority.
(* Now we proceed with the analysis.
Let tsk be any task in ts that is to be analyzed. *)
Variable tsk: SporadicTask.
Hypothesis H_tsk_in_ts: tsk \in ts.
(* Recall the definition of response-time bound and the total workload bound W
for tasks with higher-or-equal priority (with respect to tsk). *)
Let response_time_bounded_by :=
is_response_time_bound_of_task job_cost job_task sched.
Let W := total_workload_bound_fp task_cost task_period higher_eq_priority ts tsk.
(* Let R be any positive fixed point of the response-time recurrence. *)
Variable R: time.
Hypothesis H_R_positive: R > 0.
Hypothesis H_response_time_is_fixed_point: R = W R.
(* Since R = W R bounds the workload of higher-or-equal priority
in any interval of length R, it follows from the busy-interval
lemmas that R bounds the response-time of job j.
(For more details, see model/uni/basic/busy_interval.v and
analysis/uni/basic/workload_bound_fp.v.) *)
Theorem uniprocessor_response_time_bound_fp:
response_time_bounded_by tsk R.
Proof.
intros j JOBtsk.
apply busy_interval_bounds_response_time with
(job_task0 := job_task) (tsk0 := tsk)
(higher_eq_priority0 := higher_eq_priority); try (by done).
apply fp_workload_bound_holds with (task_cost0 := task_cost)
(task_period0 := task_period) (task_deadline0 := task_deadline)
(job_deadline0 := job_deadline) (ts0 := ts); try (by done).
Qed.
End ResponseTimeBound.
End ResponseTimeAnalysisFP.
\ No newline at end of file
Require Import rt.util.all.
Require Import rt.model.task rt.model.job rt.model.priority
rt.model.task_arrival rt.model.arrival_bounds.
Require Import rt.model.uni.schedule rt.model.uni.workload.
From mathcomp Require Import ssreflect ssrbool eqtype ssrnat seq fintype bigop div.
Module WorkloadBoundFP.
Import Job SporadicTaskset UniprocessorSchedule Priority Workload
TaskArrival ArrivalBounds.
(* In this section, we define a bound for the workload of a single task
under uniprocessor FP scheduling. *)
Section SingleTask.
Context {Task: eqType}.
Variable task_cost: Task -> time.
Variable task_period: Task -> time.
(* Consider any task tsk with response-time bound R_tsk, that is
scheduled in an interval of length delta. *)
Variable tsk: Task.
Variable R_tsk: time.
Variable delta: time.
(* Based on the maximum number of jobs of tsk that can execute in the interval, ... *)
Definition max_jobs := div_ceil delta (task_period tsk).
(* ... we define the following workload bound for the task. *)
Definition task_workload_bound_FP := max_jobs * task_cost tsk.
End SingleTask.
(* In this section, we define a bound for the workload of multiple tasks. *)
Section AllTasks.
Context {Task: eqType}.
Variable task_cost: Task -> time.
Variable task_period: Task -> time.
(* Assume any FP policy. *)
Variable higher_eq_priority: FP_policy Task.
(* Consider a task set ts... *)
Variable ts: list Task.
(* ...and let tsk be the task to be analyzed. *)
Variable tsk: Task.
(* Let delta be the length of the interval of interest. *)
Variable delta: time.
(* Recall the definition of higher-or-equal-priority task and
the per-task workload bound for FP scheduling. *)
Let is_hep_task tsk_other := higher_eq_priority tsk_other tsk.
Let W tsk_other :=
task_workload_bound_FP task_cost task_period tsk_other delta.
(* Using the sum of individual workload bounds, we define the following bound
for the total workload of tasks of higher-or-equal priority (with respect
to tsk) in any interval of length delta. *)
Definition total_workload_bound_fp :=
\sum_(tsk_other <- ts | is_hep_task tsk_other) W tsk_other.
End AllTasks.
(* In this section, we prove some basic lemmas about the workload bound. *)
Section BasicLemmas.
Context {Task: eqType}.
Variable task_cost: Task -> time.
Variable task_period: Task -> time.
Variable task_deadline: Task -> time.
(* Assume any FP policy. *)
Variable higher_eq_priority: FP_policy Task.
(* Consider a task set ts... *)
Variable ts: list Task.
(* ...and let tsk be any task in ts. *)
Variable tsk: Task.
Hypothesis H_tsk_in_ts: tsk \in ts.
(* Recall the workload bound for uniprocessor FP scheduling. *)
Let workload_bound :=
total_workload_bound_fp task_cost task_period higher_eq_priority ts tsk.
(* In this section we prove that the workload bound in a time window of
length (task_cost tsk) is as large as (task_cost tsk) time units.
(This is an important initial condition for the response-time analysis.) *)
Section NoSmallerThanCost.
(* Assume that the priority order is reflexive. *)
Hypothesis H_priority_is_reflexive: FP_is_reflexive higher_eq_priority.
(* Assume that cost and period of the task are positive. *)
Hypothesis H_cost_positive: task_cost tsk > 0.
Hypothesis H_period_positive: task_period tsk > 0.
(* We prove that the workload bound of an interval of size (task_cost tsk)
cannot be smaller than (task_cost tsk). *)
Lemma total_workload_bound_fp_ge_cost:
workload_bound (task_cost tsk) >= task_cost tsk.
Proof.
rename H_priority_is_reflexive into REFL.
unfold workload_bound, total_workload_bound_fp.
rewrite big_mkcond (big_rem tsk) /=; last by done.
rewrite REFL /task_workload_bound_FP.
apply leq_trans with (n := max_jobs task_period tsk (task_cost tsk) * task_cost tsk);
last by apply leq_addr.
rewrite -{1}[task_cost tsk]mul1n leq_mul2r; apply/orP; right.
by apply ceil_neq0.
Qed.
End NoSmallerThanCost.
(* In this section, we prove that the workload bound is monotonically non-decreasing. *)
Section NonDecreasing.
(* Assume that the period of every task in the task set is positive. *)
Hypothesis H_period_positive:
forall tsk,
tsk \in ts ->
task_period tsk > 0.
(* Then, the workload bound is a monotonically non-decreasing function.
(This property is important for the fixed-point iteration.) *)
Lemma total_workload_bound_fp_non_decreasing:
forall delta1 delta2,
delta1 <= delta2 ->
workload_bound delta1 <= workload_bound delta2.
Proof.
unfold workload_bound, total_workload_bound_fp; intros d1 d2 LE.
apply leq_sum_seq; intros tsk' IN HP.
rewrite leq_mul2r; apply/orP; right.
apply leq_divceil2r; last by done.
by apply H_period_positive.
Qed.
End NonDecreasing.
End BasicLemmas.
(* In this section, we prove that any fixed point R = workload_bound R
is indeed a workload bound for an interval of length R. *)
Section ProofWorkloadBound.
Context {Task: eqType}.
Variable task_cost: Task -> time.
Variable task_period: Task -> time.
Variable task_deadline: Task -> time.
Context {Job: eqType}.
Variable job_cost: Job -> time.
Variable job_deadline: Job -> time.
Variable job_task: Job -> Task.
(* Let ts be any task set with valid task parameters. *)
Variable ts: seq Task.
Hypothesis H_valid_task_parameters:
valid_sporadic_taskset task_cost task_period task_deadline ts.
(* Consider any arrival sequence with no duplicate arrivals. *)
Variable arr_seq: arrival_sequence Job.
Hypothesis H_arr_seq_is_a_set: arrival_sequence_is_a_set arr_seq.
(* Assume that all jobs come from the task set ...*)
Hypothesis H_all_jobs_from_taskset:
forall (j: JobIn arr_seq), job_task j \in ts.
(* ...and have valid parameters. *)
Hypothesis H_valid_job_parameters:
forall (j: JobIn arr_seq),
valid_sporadic_job task_cost task_deadline job_cost job_deadline job_task j.
(* Assume that jobs arrived sporadically. *)
Hypothesis H_sporadic_arrivals:
sporadic_task_model task_period arr_seq job_task.
(* Let tsk be any task in ts. *)
Variable tsk: Task.
Hypothesis H_tsk_in_ts: tsk \in ts.
(* Assume any fixed-priority policy. *)
Variable higher_eq_priority: FP_policy Task.
(* First, let's define some local names for clarity. *)
Let hp_workload :=
workload_of_higher_or_equal_priority job_cost job_task arr_seq higher_eq_priority tsk.
Let workload_bound :=
total_workload_bound_fp task_cost task_period higher_eq_priority ts tsk.
(* Consider any R that is a fixed point of the following equation,
i.e., the claimed workload bound is equal to the interval length. *)
Variable R: time.
Hypothesis H_fixed_point: R = workload_bound R.
(* Then, we prove that R is indeed a workload bound. *)
Lemma fp_workload_bound_holds:
forall t,
hp_workload t (t + R) <= R.
Proof.
have BOUND := sporadic_task_arrival_bound task_period job_task arr_seq.
feed_n 2 BOUND; try (by done).
rename H_fixed_point into FIX, H_all_jobs_from_taskset into FROMTS,
H_valid_job_parameters into JOBPARAMS,
H_valid_task_parameters into PARAMS.
unfold hp_workload, workload_of_higher_or_equal_priority,
valid_sporadic_job, valid_realtime_job,
valid_sporadic_taskset, is_valid_sporadic_task in *.
intro t.
rewrite {2}FIX /workload_bound /total_workload_bound_fp.
set l := jobs_arrived_between arr_seq t (t + R).
set hep := higher_eq_priority.
apply leq_trans with (n := \sum_(tsk' <- ts | hep tsk' tsk)
(\sum_(j0 <- l | job_task j0 == tsk') job_cost j0)).
{
have EXCHANGE := exchange_big_dep (fun (x: JobIn arr_seq) => hep (job_task x) tsk).
rewrite EXCHANGE /=; last by move => tsk0 j0 HEP /eqP JOB0; rewrite JOB0.
apply leq_sum; intros j0 HP0.
rewrite big_mkcond (big_rem (job_task j0)) /=; last by rewrite FROMTS.
by rewrite HP0 andTb eq_refl; apply leq_addr.
}
apply leq_sum_seq; intros tsk0 IN0 HP0.
apply leq_trans with (n := num_arrivals_of_task job_task arr_seq tsk0 t (t + R) * task_cost tsk0).
{
rewrite /num_arrivals_of_task -sum1_size big_distrl /=.
rewrite big_filter; apply leq_sum; move => j0 /eqP EQ; rewrite -EQ mul1n.
by specialize (JOBPARAMS j0); des.
}
rewrite /task_workload_bound_FP leq_mul2r; apply/orP; right.
feed (BOUND t (t + R) tsk0); first by feed (PARAMS tsk0); last by des.
by rewrite addKn in BOUND.
Qed.
End ProofWorkloadBound.
End WorkloadBoundFP.
\ No newline at end of file
......@@ -6,7 +6,7 @@ From mathcomp Require Import ssreflect ssrbool ssrfun ssrnat eqtype seq div.
Module ConcreteArrivalSequence.
Import Job ArrivalSequence ConcreteTask ConcreteJob SporadicTaskset SporadicTaskArrival.
Import Job ArrivalSequence ConcreteTask ConcreteJob SporadicTaskset TaskArrival.
Section PeriodicArrivals.
......
......@@ -516,7 +516,7 @@ Module ConcreteScheduler.
have IN: j \in l.
{
rewrite mem_sort mem_filter PENDING andTb JobIn_has_arrived.
rewrite mem_sort mem_filter PENDING andTb JobIn_arrived.
by move: PENDING => /andP [H _].
}
have INhp: j_hp \in l by apply scheduler_job_in_mapping in SCHED.
......@@ -629,7 +629,7 @@ Module ConcreteScheduler.
apply scheduler_job_in_mapping in SCHED.
rewrite mem_sort mem_filter in SCHED.
move: SCHED => /andP [_ ARR].
by apply JobIn_has_arrived in ARR.
by apply JobIn_arrived in ARR.
}
{
unfold update_schedule at 1 in SCHED; rewrite eq_refl /= in SCHED.
......@@ -638,7 +638,7 @@ Module ConcreteScheduler.
apply scheduler_job_in_mapping in SCHED.
rewrite mem_sort mem_filter in SCHED.
move: SCHED => /andP [_ ARR].
by apply JobIn_has_arrived in ARR.
by apply JobIn_arrived in ARR.
}
Qed.
......@@ -712,7 +712,7 @@ Module ConcreteScheduler.
move: BACK => /andP [PENDING NOTSCHED].
have IN: j \in l.
{
rewrite mem_sort mem_filter PENDING andTb JobIn_has_arrived.
rewrite mem_sort mem_filter PENDING andTb JobIn_arrived.
by move: PENDING => /andP [H _].
}
have WORK := scheduler_mapping_is_work_conserving j cpu t l IN SORT UNIQ.
......
Require Import rt.util.all.
Require Import rt.model.arrival_sequence rt.model.job