Library prosa.analysis.facts.busy_interval.busy_interval
Require Export prosa.model.schedule.work_conserving.
Require Export prosa.analysis.definitions.job_properties.
Require Export prosa.analysis.definitions.priority_inversion.
Require Export prosa.analysis.facts.behavior.all.
Require Export prosa.analysis.facts.model.service_of_jobs.
Require Export prosa.analysis.definitions.work_bearing_readiness.
Require Export prosa.analysis.definitions.job_properties.
Require Export prosa.analysis.definitions.priority_inversion.
Require Export prosa.analysis.facts.behavior.all.
Require Export prosa.analysis.facts.model.service_of_jobs.
Require Export prosa.analysis.definitions.work_bearing_readiness.
Throughout this file, we assume ideal uni-processor schedules.
Require Import prosa.model.processor.ideal.
Require Import prosa.analysis.facts.model.ideal.schedule.
Require Export prosa.analysis.facts.busy_interval.ideal.priority_inversion.
Require Import prosa.analysis.facts.model.ideal.schedule.
Require Export prosa.analysis.facts.busy_interval.ideal.priority_inversion.
Existence of Busy Interval for JLFP-models
In this module we derive a sufficient condition for existence of busy intervals for uni-processor for JLFP schedulers.
Consider any type of tasks ...
... and any type of jobs associated with these tasks.
Context {Job : JobType}.
Context {JobTask : JobTask Job Task}.
Context {Arrival: JobArrival Job}.
Context {Cost : JobCost Job}.
Context {JobTask : JobTask Job Task}.
Context {Arrival: JobArrival Job}.
Context {Cost : JobCost Job}.
Consider any arrival sequence with consistent arrivals.
Variable arr_seq : arrival_sequence Job.
Hypothesis H_arrival_times_are_consistent : consistent_arrival_times arr_seq.
Hypothesis H_arrival_times_are_consistent : consistent_arrival_times arr_seq.
Next, consider any ideal uni-processor schedule of this arrival sequence ...
Variable sched : schedule (ideal.processor_state Job).
Hypothesis H_jobs_come_from_arrival_sequence:
jobs_come_from_arrival_sequence sched arr_seq.
Hypothesis H_jobs_come_from_arrival_sequence:
jobs_come_from_arrival_sequence sched arr_seq.
... where jobs do not execute before their arrival or after completion.
Hypothesis H_jobs_must_arrive_to_execute : jobs_must_arrive_to_execute sched.
Hypothesis H_completed_jobs_dont_execute : completed_jobs_dont_execute sched.
Hypothesis H_completed_jobs_dont_execute : completed_jobs_dont_execute sched.
Assume a given JLFP policy.
Further, allow for any work-bearing notion of job readiness.
Context `{@JobReady Job (ideal.processor_state Job) Cost Arrival}.
Hypothesis H_job_ready : work_bearing_readiness arr_seq sched.
Hypothesis H_job_ready : work_bearing_readiness arr_seq sched.
For simplicity, let's define some local names.
Consider an arbitrary task tsk.
Consider an arbitrary job j.
Variable j : Job.
Hypothesis H_from_arrival_sequence : arrives_in arr_seq j.
Hypothesis H_job_task : job_of_task tsk j.
Hypothesis H_job_cost_positive : job_cost_positive j.
Hypothesis H_from_arrival_sequence : arrives_in arr_seq j.
Hypothesis H_job_task : job_of_task tsk j.
Hypothesis H_job_cost_positive : job_cost_positive j.
Recall the list of jobs that arrive in any interval.
Let quiet_time t1 := quiet_time arr_seq sched j t1.
Let quiet_time_dec t1 := quiet_time_dec arr_seq sched j t1.
Let busy_interval_prefix t1 t2 := busy_interval_prefix arr_seq sched j t1 t2.
Let busy_interval t1 t2 := busy_interval arr_seq sched j t1 t2.
Let is_priority_inversion_bounded_by K := priority_inversion_of_job_is_bounded_by_constant arr_seq sched j K.
Let quiet_time_dec t1 := quiet_time_dec arr_seq sched j t1.
Let busy_interval_prefix t1 t2 := busy_interval_prefix arr_seq sched j t1 t2.
Let busy_interval t1 t2 := busy_interval arr_seq sched j t1 t2.
Let is_priority_inversion_bounded_by K := priority_inversion_of_job_is_bounded_by_constant arr_seq sched j K.
We begin by proving a basic lemma about busy intervals.
Assume that the priority relation is reflexive.
Consider any busy interval
[t1, t2)
of job j.
We prove that job j completes by the end of the busy interval.
In this section, we prove that during a busy interval there
always exists a pending job.
Variable t1 t2 : instant.
Hypothesis H_interval : t1 ≤ t2.
Hypothesis H_quiet : quiet_time t1.
Hypothesis H_not_quiet : ¬ quiet_time t2.
Hypothesis H_interval : t1 ≤ t2.
Hypothesis H_quiet : quiet_time t1.
Hypothesis H_not_quiet : ¬ quiet_time t2.
Then, we prove that there is a job pending at time t2
that has higher or equal priority (with respect to tsk).
Lemma not_quiet_implies_exists_pending_job:
∃ j_hp,
arrives_in arr_seq j_hp ∧
arrived_between j_hp t1 t2 ∧
hep_job j_hp j ∧
¬ job_completed_by j_hp t2.
End ExistsPendingJob.
∃ j_hp,
arrives_in arr_seq j_hp ∧
arrived_between j_hp t1 t2 ∧
hep_job j_hp j ∧
¬ job_completed_by j_hp t2.
End ExistsPendingJob.
In this section, we prove that during a busy interval the
processor is never idle.
Assume that the schedule is work-conserving ...
... and the priority relation is reflexive and transitive.
Hypothesis H_priority_is_reflexive : reflexive_priorities.
Hypothesis H_priority_is_transitive : transitive_priorities.
Hypothesis H_priority_is_transitive : transitive_priorities.
Consider any busy interval prefix
[t1, t2)
.
We prove that if the processor is idle at a time instant t,
then the next time instant t+1 will be a quiet time.
Lemma idle_time_implies_quiet_time_at_the_next_time_instant:
∀ (t : instant),
is_idle sched t →
quiet_time t.+1.
∀ (t : instant),
is_idle sched t →
quiet_time t.+1.
Next, we prove that at any time instant t within the busy interval there exists a job
jhp such that (1) job jhp is pending at time t and (2) job jhp has higher-or-equal
priority than task tsk.
Lemma pending_hp_job_exists:
∀ t,
t1 ≤ t < t2 →
∃ jhp,
arrives_in arr_seq jhp ∧
job_pending_at jhp t ∧
hep_job jhp j.
∀ t,
t1 ≤ t < t2 →
∃ jhp,
arrives_in arr_seq jhp ∧
job_pending_at jhp t ∧
hep_job jhp j.
We prove that at any time instant t within
[t1, t2)
the processor is not idle.
In section we prove a few auxiliary lemmas about quiet time and service.
Assume that the schedule is work-conserving ...
... and there are no duplicate job arrivals.
Let t1 be a quiet time.
Assume that there is no quiet time in the interval
(t1, t1 + Δ]
.
For clarity, we introduce a notion of the total service of
jobs released in time interval
[t_beg, t_end)
during the
time interval [t1, t1 + Δ)
.
Let service_received_by_hep_jobs_released_during t_beg t_end :=
service_of_higher_or_equal_priority_jobs
sched (arrivals_between arr_seq t_beg t_end) j t1 (t1 + Δ).
service_of_higher_or_equal_priority_jobs
sched (arrivals_between arr_seq t_beg t_end) j t1 (t1 + Δ).
We prove that jobs with higher-than-or-equal priority that
released before time instant t1 receive no service after time
instant t1.
Lemma hep_jobs_receive_no_service_before_quiet_time:
service_received_by_hep_jobs_released_during t1 (t1 + Δ) =
service_received_by_hep_jobs_released_during 0 (t1 + Δ).
service_received_by_hep_jobs_released_during t1 (t1 + Δ) =
service_received_by_hep_jobs_released_during 0 (t1 + Δ).
Next we prove that the total service within a "non-quiet"
time interval
[t1, t1 + Δ)
is exactly Δ.
Lemma no_idle_time_within_non_quiet_time_interval:
total_service_of_jobs_in sched (arrivals_between arr_seq 0 (t1 + Δ)) t1 (t1 + Δ) = Δ.
End QuietTimeAndServiceOfJobs.
total_service_of_jobs_in sched (arrivals_between arr_seq 0 (t1 + Δ)) t1 (t1 + Δ) = Δ.
End QuietTimeAndServiceOfJobs.
In this section, we show that the length of any busy interval
is bounded, as long as there is enough supply to accommodate
the workload of tasks with higher or equal priority.
Assume that the schedule is work-conserving, ...
... and there are no duplicate job arrivals, ...
... and the priority relation is reflexive and transitive.
Hypothesis H_priority_is_reflexive: reflexive_priorities.
Hypothesis H_priority_is_transitive: transitive_priorities.
Hypothesis H_priority_is_transitive: transitive_priorities.
Next, we recall the notion of workload of all jobs released in
a given interval
[t1, t2)
that have higher-or-equal
priority w.r.t. the job j being analyzed.
Let hp_workload t1 t2 :=
workload_of_higher_or_equal_priority_jobs j (arrivals_between arr_seq t1 t2).
workload_of_higher_or_equal_priority_jobs j (arrivals_between arr_seq t1 t2).
With regard to the jobs with higher-or-equal priority that are released
in a given interval
[t1, t2)
, we also recall the service received by these
jobs in the same interval [t1, t2)
.
Let hp_service t1 t2 :=
service_of_higher_or_equal_priority_jobs
sched (arrivals_between arr_seq t1 t2) j t1 t2.
service_of_higher_or_equal_priority_jobs
sched (arrivals_between arr_seq t1 t2) j t1 t2.
Now we begin the proof. First, we show that the busy interval is bounded.
First, we show that there must exist a busy interval prefix.
Since job j is pending, there is a (potentially unbounded)
busy interval that starts no later than with the arrival of j.
Lemma exists_busy_interval_prefix:
∃ t1,
busy_interval_prefix t1 t_busy.+1 ∧
t1 ≤ job_arrival j ≤ t_busy.
End LowerBound.
∃ t1,
busy_interval_prefix t1 t_busy.+1 ∧
t1 ≤ job_arrival j ≤ t_busy.
End LowerBound.
Next we prove that, if there is a point where the requested
workload is upper-bounded by the supply, then the busy
interval eventually ends.
Consider any busy interval prefix of job j.
Let priority_inversion_bound be a constant that bounds
the length of any priority inversion.
Variable priority_inversion_bound : instant.
Hypothesis H_priority_inversion_is_bounded :
is_priority_inversion_bounded_by priority_inversion_bound.
Hypothesis H_priority_inversion_is_bounded :
is_priority_inversion_bounded_by priority_inversion_bound.
Next, assume that for some positive delta, the sum of requested workload
at time t1 + delta and constant priority_inversion_bound is bounded by
delta (i.e., the supply).
Variable delta : duration.
Hypothesis H_delta_positive : delta > 0.
Hypothesis H_workload_is_bounded :
priority_inversion_bound + hp_workload t1 (t1 + delta) ≤ delta.
Hypothesis H_delta_positive : delta > 0.
Hypothesis H_workload_is_bounded :
priority_inversion_bound + hp_workload t1 (t1 + delta) ≤ delta.
If there is a quiet time by time t1 + delta, it
trivially follows that the busy interval is bounded.
Thus, let's consider first the harder case where there is
no quiet time, which turns out to be impossible.
Assume that there is no quiet time in the interval
(t1, t1 + delta]
.
Since the interval is always non-quiet, the processor is
always busy with tasks of higher-or-equal priority or
some lower priority job which was scheduled, i.e., the
sum of service done by jobs with actual arrival time in
[t1, t1 + delta)
and priority inversion equals
delta.
Lemma busy_interval_has_uninterrupted_service:
delta ≤ priority_inversion_bound + hp_service t1 (t1 + delta).
delta ≤ priority_inversion_bound + hp_service t1 (t1 + delta).
Moreover, the fact that the interval is not quiet also
implies that there's more workload requested than
service received.
Using the two lemmas above, we infer that the workload
is larger than the interval length. However, this
contradicts the assumption H_workload_is_bounded.
Corollary busy_interval_workload_larger_than_interval:
priority_inversion_bound + hp_workload t1 (t1 + delta) > delta.
End CannotBeBusyForSoLong.
priority_inversion_bound + hp_workload t1 (t1 + delta) > delta.
End CannotBeBusyForSoLong.
Since the interval cannot remain busy for so long, we
prove that the busy interval finishes at some point t2 ≤
t1 + delta.
Lemma busy_interval_is_bounded:
∃ t2,
t2 ≤ t1 + delta ∧
busy_interval t1 t2.
End UpperBound.
End BoundingBusyInterval.
∃ t2,
t2 ≤ t1 + delta ∧
busy_interval t1 t2.
End UpperBound.
End BoundingBusyInterval.
In this section, we show that from a workload bound we can
infer the existence of a busy interval.
Let priority_inversion_bound be a constant that bounds the length of a priority inversion.
Variable priority_inversion_bound: duration.
Hypothesis H_priority_inversion_is_bounded:
is_priority_inversion_bounded_by priority_inversion_bound.
Hypothesis H_priority_inversion_is_bounded:
is_priority_inversion_bounded_by priority_inversion_bound.
Assume that for some positive delta, the sum of requested workload at
time t1 + delta and priority inversion is bounded by delta (i.e., the supply).
Variable delta: duration.
Hypothesis H_delta_positive: delta > 0.
Hypothesis H_workload_is_bounded:
∀ t, priority_inversion_bound + hp_workload t (t + delta) ≤ delta.
Hypothesis H_delta_positive: delta > 0.
Hypothesis H_workload_is_bounded:
∀ t, priority_inversion_bound + hp_workload t (t + delta) ≤ delta.
Next, we assume that job j has positive cost, from which we
can infer that there is a time in which j is pending.
Therefore there must exists a busy interval
[t1, t2)
that
contains the arrival time of j.
Corollary exists_busy_interval:
∃ t1 t2,
t1 ≤ job_arrival j < t2 ∧
t2 ≤ t1 + delta ∧
busy_interval t1 t2.
End BusyIntervalFromWorkloadBound.
∃ t1 t2,
t1 ≤ job_arrival j < t2 ∧
t2 ≤ t1 + delta ∧
busy_interval t1 t2.
End BusyIntervalFromWorkloadBound.
If we know that the workload is bounded, we can also use the
busy interval to infer a response-time bound.
Let priority_inversion_bound be a constant that bounds the length of a priority inversion.
Variable priority_inversion_bound: duration.
Hypothesis H_priority_inversion_is_bounded:
is_priority_inversion_bounded_by priority_inversion_bound.
Hypothesis H_priority_inversion_is_bounded:
is_priority_inversion_bounded_by priority_inversion_bound.
Assume that for some positive delta, the sum of requested workload at
time t1 + delta and priority inversion is bounded by delta (i.e., the supply).
Variable delta: duration.
Hypothesis H_delta_positive: delta > 0.
Hypothesis H_workload_is_bounded:
∀ t, priority_inversion_bound + hp_workload t (t + delta) ≤ delta.
Hypothesis H_delta_positive: delta > 0.
Hypothesis H_workload_is_bounded:
∀ t, priority_inversion_bound + hp_workload t (t + delta) ≤ delta.