Library prosa.analysis.facts.model.work_conserving

Facts About Work Conservation

We relate work conservation to the existence of scheduled jobs. On a uniprocessor, it suffices that some job executes whenever a job is backlogged.
Section WorkConservation.

Consider jobs with arrival times and costs, and any processor and readiness model.
  Context {Job : JobType} `{JobArrival Job} `{JobCost Job}.
  Context {PState : ProcessorState Job} {jr : JobReady Job PState}.

Consider any arrival sequence and schedule.
  Variable arr_seq : arrival_sequence Job.
  Variable sched : schedule PState.

If there is at least one core, work conservation ensures that some job executes whenever an arriving job is backlogged.
  Lemma work_conserving_implies_scheduled_job :
    0 < #|Core| →
    work_conserving arr_seq sched →
    ∀ j t,
      arrives_in arr_seq j →
      backlogged sched j t →
      ∃ j_other,
        scheduled_at sched j_other t.
  Proof.
    move⇒ /card_gt0P [c _] WC j t ARR BACK.
    case: (WC j t ARR BACK c) ⇒ j_other ON.
    ∃ j_other; apply/existsP.
    by ∃ c.
  Qed.

Assume that the processor has exactly one core.
  Hypothesis H_uni : uniprocessor_model PState.

To establish work conservation on a uniprocessor, it is sufficient to show that some job executes whenever a job from the arrival sequence is backlogged.
  Lemma uniprocessor_work_conserving :
    (∀ j t,
       arrives_in arr_seq j →
       backlogged sched j t →
       ∃ j_other,
         scheduled_at sched j_other t) →
    work_conserving arr_seq sched.
  Proof.
    move⇒ WC j t ARR BACK c.
    case: (WC j t ARR BACK) ⇒ j_other /existsP [c' ON].
    ∃ j_other.
    by rewrite -(uniprocessor_core_unique H_uni c' c).
  Qed.

End WorkConservation.