Library prosa.model.preemption.limited_preemptive


(* ----------------------------------[ coqtop ]---------------------------------

Welcome to Coq 8.11.2 (June 2020)

----------------------------------------------------------------------------- *)


Require Export prosa.model.preemption.parameter.

Job Model Parameter for Preemption Points

Under the limited-preemptive preemption model, jobs can be preempted only at a precise set of points during their execution. To allow such fixed, progress-dependent preemption points to be specified, we introduce a new job parameter [job_preemption_points] that, for each job, yields the set of progress values at which the job can be preempted by the scheduler.
Class JobPreemptionPoints (Job : JobType) :=
  {
    job_preemption_points : Job seq work
  }.

Preemption Model: Limited-Preemptive Jobs

Based on the above definition of [job_preemption_points], in the following we instantiate [job_preemptable] for limited-preemptive jobs and introduce requirements that the function [job_preemption_points] should satisfy to be coherent with the limited-preemptive preemption model.
Consider any type of jobs with arrival times and execution costs.
  Context {Job : JobType}.
  Context `{JobArrival Job}.
  Context `{JobCost Job}.

Given each job's preemption points, as determined by [job_preemption_points], ...
  Context `{JobPreemptionPoints Job}.

...a job [j] is preemptable at a given point of progress [ρ] iff [ρ] is one of the preemption points of [j].
  Global Instance limited_preemptions_model : JobPreemptable Job :=
    {
      job_preemptable (j : Job) (ρ : work) := ρ \in job_preemption_points j
    }.

Model Validity

Next, we introduce some structural properties that a valid sequence of preemption points must satisfy.
Consider any arrival sequence.
    Variable arr_seq : arrival_sequence Job.

We require the sequence of preemption points to contain the beginning ...
... and the end of execution for any job [j] that arrives in the given arrival sequence [arr_seq].
We further require the sequence of preemption points to be a non-decreasing sequence.
A job model is considered valid w.r.t. limited-preemptive preemption model if it satisfies each of the preceding definitions.