Library prosa.behavior.schedule
Generic Processor State Interface
A ProcessorState instance provides a finite set of cores on which
jobs can be scheduled. In the case of uniprocessors, this is irrelevant
and may be ignored (by convention, the unit type is used as a
placeholder in uniprocessor schedules, but this is not
important). (Hint to the Coq novice: finType just means some type
with finitely many values, i.e., it is possible to enumerate all cores
of a multi-processor.)
For a given processor state and core, the scheduled_on predicate
checks whether a given job is running on the given core.
For a given processor state and core, the supply_on function
determines how much supply the core produces in the given
state).
For a given processor state and core, the service_on
function determines how much service a given job receives on
the given core).
We require service_on and supply_on to be consistent in
the sense that a job cannot receive more service on a given
core in a given state than there is supply on the core in this
state.
In addition, a job can receive service (on a given core) only
if it is also scheduled (on that core).
service_on_implies_scheduled_on :
∀ j s r, ~~ scheduled_on j s r → service_on j s r = 0
}.
Coercion State : ProcessorState >-> Sortclass.
∀ j s r, ~~ scheduled_on j s r → service_on j s r = 0
}.
Coercion State : ProcessorState >-> Sortclass.
The above definition of the ProcessorState interface provides
the predicate scheduled_on and the function service_on, which
relate a given job to a given core in a given state. This level of
detail is required for generality, but in many situations it
suffices and is more convenient to elide the information about
individual cores, instead referring to all cores at once. To this
end, we next define the short-hand functions scheduled_in and
service_in to directly check whether a job is scheduled at all
(i.e., on any core), and how much service the job receives
anywhere (i.e., across all cores).
Consider any type of jobs...
...and any type of processor state.
For a given processor state, the scheduled_in predicate checks
whether a given job is running on any core in that state.
For a given processor state, the supply_in function determines
how much supply the processor provides (across all cores) in the given state.
For a given processor state, the service_in function
determines how much service a given job receives in that state
(across all cores).
Definition service_in (j : Job) (s : State) : work :=
\sum_(r : Core) service_on j s r.
End ProcessorIn.
\sum_(r : Core) service_on j s r.
End ProcessorIn.
Schedule Representation
The following line instructs Coq to not let proofs use knowledge of how
scheduled_on and service_on are defined. Instead,
proofs must rely on basic lemmas about processor state classes.