Library prosa.analysis.facts.model.overheads.schedule_change_bound

In this file, we prove upper bounds on the total number of schedule changes that can occur within a busy-interval prefix under FIFO, FP, and general JLFP scheduling policies.

Number of Schedule Changes is Bounded by the Number of Arrivals

We begin by proving a set of helper lemmas that relate the number of schedule changes to the number of job arrivals within a given busy-interval prefix.
Consider any type of jobs.
  Context {Job : JobType}.
  Context `{JobArrival Job}.
  Context `{JobCost Job}.

Consider a JLFP-policy that indicates a higher-or-equal priority relation, and assume that this relation is reflexive and transitive.
We assume the classic (i.e., Liu & Layland) model of readiness without jitter or self-suspensions, wherein pending jobs are always ready.
  #[local] Existing Instance basic_ready_instance.

Consider any valid arrival sequence...
... and any explicit-overhead uni-processor schedule without superfluous preemptions.
Consider any valid preemption model.
Assume that the schedule respects the JLFP policy.
Consider any job j that has a positive job cost and is in the arrival sequence.
  Variable j : Job.
  Hypothesis H_j_arrives : arrives_in arr_seq j.
  Hypothesis H_job_cost_positive : job_cost_positive j.

Consider any busy interval prefix [t1, t2) of job j.
We define a helper predicate that holds if some job completes at time t.
To reason about the number of schedule changes, we first show that any change in the schedule at time t must be caused by either a priority bump or a job completion.
  Local Lemma schedule_change_caused_by_bump_or_completion :
     (t : instant),
      t > 0
      t1 t < t2
      schedule_change sched t
      priority_bump sched t || some_job_completes_at t.

As a simple corollary, the number of schedule changes in [t1.+1, t) is bounded by the number of time instants in that interval where either a priority bump occurs or some job completes.
Note: The interval starts at t1.+1 because we do not account for a schedule change at the very first instant of a busy interval. Even if such a change occurs, it is not relevant for our later analysis.

LP and HEP completions are bounded

We now turn to bounding the number of "causes" that could lead to schedule changes within a busy interval prefix. In particular, we consider two types of events: (i) priority bumps, and (ii) job completions. We show that the number of such events is also bounded.
Let us first define the total number of low-priority job completions that occur during the interval (t1, t2). Note that completions exactly at t1 are ignored.
Similarly, we define the number of higher-or-equal-priority job completions in the same interval.
Let us fix a time instant t within the busy-interval prefix.
  Variable t : instant.
  Hypothesis H_t_in_busy_prefix : t1 < t t2.

When a low-priority job completes, it necessarily triggers a priority bump. Hence, the number of low-priority completions is bounded by the number of instants in which both a priority bump and a job completion occur.
Under FIFO scheduling, priorities are determined solely by arrival times. Since a job cannot complete before earlier-arriving jobs, no low-priority job can complete while any higher-priority job is incomplete. Hence, low-priority completions cannot occur.
A higher-or-equal-priority job can complete at most once. Thus, the number of higher-or-equal-priority completions is bounded by the number of such jobs that arrive during the busy-interval prefix.

Bounding the number of schedule-change causes

Every job completion must be either a higher-or-equal priority or lower-priority job. Thus, the total number of instants in which some job completes is bounded by the number of completions of LP and HEP jobs.
Priority bumps can only be caused by newly arrived higher-or-equal priority jobs. Therefore, the number of time instants with a priority bump is bounded by the number of such jobs.
In the special case of FIFO priority policy, no priority bump can occur within the interval.

Putting bounds together

The number of instants with either a priority bump or a job completion is at most twice the number of jobs that have higher-or-equal priority than j and arrive in [t1, t).
Intuitively, each such job may trigger at most one priority bump and complete once, and these are the only events that can appear in the considered set.
Under FIFO scheduling, the number of instants with either a priority bump or a job completion is at most the number of higher-or-equal priority jobs (i.e., earlier or equal arrival time) in [t1, t).
This is because, under FIFO, priority bumps cannot occur, and each such job may complete at most once.

Number of schedule changes is bounded

In this section, we prove that the number of schedule changes in a busy-interval prefix is bounded under JLFP scheduling.
Section JLFP.

Consider any type of jobs.
  Context {Job : JobType}.
  Context `{JobArrival Job}.
  Context `{JobCost Job}.
  Context `{JobPreemptable Job}.

Consider a JLFP-policy that indicates a higher-or-equal priority relation, and assume that this relation is reflexive and transitive.
We assume the classic (i.e., Liu & Layland) model of readiness without jitter or self-suspensions, wherein pending jobs are always ready.
  #[local] Existing Instance basic_ready_instance.

Consider any valid arrival sequence...
... and any explicit-overhead uni-processor schedule without superfluous preemptions of this arrival sequence.
Assume that the schedule respects the JLFP policy.
Assume that the preemption model is valid.
Consider any job j that has a positive job cost and is in the arrival sequence.
  Variable j : Job.
  Hypothesis H_j_arrives : arrives_in arr_seq j.
  Hypothesis H_job_cost_positive : job_cost_positive j.

Consider any busy interval prefix [t1, t2) of job j.
Next, consider any type of tasks ...
  Context {Task : TaskType}.
  Context `{MaxArrivals Task}.
  Context `{JobTask Job Task}.

... and an arbitrary task set ts.
  Variable ts : seq Task.

Assume that all jobs stem from tasks in this task set.
We assume that max_arrivals is a family of arrival curves that constrains the arrival sequence arr_seq.
Consider an interval [t1, t1 + Δ) ⊆ [t1, t2).
  Variable Δ : duration.
  Hypothesis H_subinterval : t1 + Δ t2.

The number of schedule changes in the interval [t1 + 1, t1 + Δ) is bounded by twice the total number of job arrivals across all tasks during Δ.
The factor of 2 arises because each arriving job can cause at most one job completion and one priority bump.
In this section, we prove that the number of schedule changes in a busy-interval prefix is bounded under FP scheduling.
Section FP.

Consider any type of tasks ...
  Context {Task : TaskType}.
  Context `{MaxArrivals Task}.
  Context `{FP : FP_policy Task}.

... and any type of jobs associated with these tasks.
  Context {Job : JobType}.
  Context `{JobArrival Job}.
  Context `{JobTask Job Task}.
  Context `{JobCost Job}.
  Context `{JobPreemptable Job}.

Consider an FP-policy that indicates a higher-or-equal priority relation, and assume that this relation is reflexive and transitive.
We assume the classic (i.e., Liu & Layland) model of readiness without jitter or self-suspensions, wherein pending jobs are always ready.
  #[local] Existing Instance basic_ready_instance.

Consider any valid arrival sequence...
... and any explicit-overhead uni-processor schedule without superfluous preemptions of this arrival sequence.
Assume that the schedule respects the FP policy.
Assume that the preemption model is valid.
Consider any job j that has a positive job cost and is in the arrival sequence.
  Variable j : Job.
  Hypothesis H_j_arrives : arrives_in arr_seq j.
  Hypothesis H_job_cost_positive : job_cost_positive j.

Consider any busy interval prefix [t1, t2) of job j.
Next, we consider an arbitrary task set ts ...
  Variable ts : seq Task.

... and assume that all jobs stem from tasks in this task set.
We assume that max_arrivals is a family of arrival curves that constrains the arrival sequence arr_seq.
Consider an interval [t1, t1 + Δ) ⊆ [t1, t2).
  Variable Δ : duration.
  Hypothesis H_subinterval : t1 + Δ t2.

Under FP scheduling, we bound the number of schedule changes in [t1 + 1, t1 + Δ) by twice the number of arrivals of tasks with priority higher than or equal to the task of job j.
As before, each arrival may lead to at most one priority bump and one completion. Furthermore, tasks with lower priority cannot initiate a schedule change.
In this section, we prove that the number of schedule changes in a busy-interval prefix is bounded under FIFO scheduling.
Section FIFO.

Consider any type of jobs.
  Context {Job : JobType}.
  Context `{JobArrival Job}.
  Context `{JobCost Job}.
  Context `{JobPreemptable Job}.

Consider a FIFO priority policy that indicates a higher-or-equal priority relation.
  Context {JLFP : JLFP_policy Job}.
  Hypothesis H_FIFO : policy_is_FIFO JLFP.

We assume the classic (i.e., Liu & Layland) model of readiness without jitter or self-suspensions, wherein pending jobs are always ready.
  #[local] Existing Instance basic_ready_instance.

Consider any valid arrival sequence...
... and any explicit-overhead uni-processor schedule without superfluous preemptions of this arrival sequence.
Assume that the schedule respects the JLFP (i.e., FIFO) policy.
Assume that the preemption model is valid.
Consider any job j that has a positive job cost and is in the arrival sequence.
  Variable j : Job.
  Hypothesis H_j_arrives : arrives_in arr_seq j.
  Hypothesis H_job_cost_positive : job_cost_positive j.

Consider any busy interval prefix [t1, t2) of job j.
Next, consider any type of tasks ...
  Context {Task : TaskType}.
  Context `{MaxArrivals Task}.
  Context `{JobTask Job Task}.

... and an arbitrary task set ts.
  Variable ts : seq Task.

Assume that all jobs stem from tasks in this task set.
We assume that max_arrivals is a family of arrival curves that constrains the arrival sequence arr_seq.
Consider an interval [t1, t1 + Δ) ⊆ [t1, t2).
  Variable Δ : duration.
  Hypothesis H_subinterval : t1 + Δ t2.

Under FIFO scheduling, no priority bumps can occur. Thus, the number of schedule changes in [t1 + 1, t1 + Δ) is at most the number of job arrivals during an interval of length Δ.