Library prosa.analysis.facts.model.multiprocessor

Unit Service on Multiprocessors

In the following, we show that unit-service cores provide unit service to each job when the schedule excludes intra-job parallelism.
Section UnitService.

Consider any job type and per-core processor model.
  Context {Job : JobType}.
  Variable core_state : ProcessorState Job.

Each core is a uniprocessor that provides unit service.
Construct a multiprocessor with any number of these cores.
  Variable num_cores : nat.
  Let PState := multiproc_state Job core_state H_cores_are_uniprocessors num_cores.
  #[local] Existing Instance PState.

Consider a schedule in which no job executes on two cores at once.
  Variable sched : schedule PState.
  Hypothesis H_no_parallelism : no_intra_job_parallelism sched.

  Local Transparent service_on.

At most one core can provide service to a job, so the per-core unit-service bound also bounds its total service at each instant.
  Lemma multiprocessor_has_unit_service :
    unit_service_schedule sched.
  Proof.
    move⇒ j t.
    case: (boolP (scheduled_at sched j t)) ⇒ [/existsP[c ON]|OFF].
    - rewrite /service_at /service_in (bigD1 c) //=.
      rewrite big1 ?addn0.
      + move⇒ c' NE.
        change (service_on j (sched t) c' = 0).
        apply: service_on_implies_job_on.
        apply/negP ⇒ ON'.
        by move: NE; rewrite (H_no_parallelism j t c' c ON' ON) eqxx.
      + exact: H_unit_service.
    - by rewrite not_scheduled_implies_no_service.
  Qed.

End UnitService.

We register this implication so that unit service can be established from the per-core bound and the schedule's restriction on parallelism.
Global Hint Resolve multiprocessor_has_unit_service : basic_rt_facts.