Expand description
SchedContext API + supporting types.
A SchedContext is a first-class scheduling capability. Multiple
callbacks share one SC; one OS priority slot per Executor regardless
of callback count. Inspired by seL4 MCS (Mixed-Criticality
Scheduling).
110.B.a (this commit) lands the type surface + EdfReadySet. The
Executor builder methods (create_sched_context,
, …) and the cbindgen / C / C++ wrappers
land in 110.B.b once the const-generic register_subscription_inExecutor<MAX_HANDLES, MAX_SC> reshape is sorted.
Structs§
- Atomic
Sporadic State - Atomic sporadic-server state for ISR-driven
refill. ISR / timer-thread context calls refill_thunk to top up
the budget; spin_once reads atomically without any
&mutaccess. - OptUs
- Optional time field with a sentinel
0for “absent”. - Sched
Context - First-class scheduling capability — one SC per scheduling concern, shared by every callback that should run under the same budget / period / deadline / class.
- Sched
Context Id - Identifier for a
SchedContextregistered with an Executor. 110.B.b adds storage[Option<SchedContext>; MAX_SC]; this index addresses into that array. - Sporadic
State - User-space sporadic-server runtime state.
- Time
Triggered Schedule - Fixed-size, no_std-friendly cyclic schedule.
Nis the declared maximum window count;window_countis the active length (callers can build the array up toNand setwindow_countto the actual size used). - Time
Triggered Window - One slot in a time-triggered schedule.
Enums§
- Deadline
Action - What the executor DOES when a dispatched
callback runs past its bound SC’s
deadline_us. Distinct fromDeadlinePolicy(which says where the deadline COMES from); this is the miss REACTION, lowered from the sched task table’sdeadline_policystring (ignore | warn | skip | fault). - Deadline
Policy - How an EDF deadline is interpreted relative to a callback firing.
- Priority
- Criticality bucket for
SchedContext. The ready set uses this to pick whichRankedFifoSet/BucketedEdfSetslot a callback dispatches through; later work maps it to OS priority. - Sched
Class - Scheduling class — picks the runtime queue + selection policy for the contained callbacks.
- Time
Triggered Schedule Error - Validation errors for a
TimeTriggeredSchedule.
Constants§
- DISPATCH_
LEVELS - The number of dispatch levels one executor orders by: one per bit of the ready set’s 32-bit presence word.
- MAX_
CONTRACT_ RANK - The largest contract rank a
Normalcallback keeps. Levels 0 and 31 are the reservedCriticalandBestEffortranks, so the contract’s ranks are levels 1..=30; a rank past this one shares the last.
Functions§
- atomic_
sporadic_ refill_ thunk - C-callable refill thunk that
PlatformTimer::create_periodicinvokes from the platform’s timer context. Single atomic store — safe in any thread / ISR context.