Skip to main content

Module sched_context

Module sched_context 

Source
Expand description

Phase 110.B — 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, register_subscription_in, …) and the cbindgen / C / C++ wrappers land in 110.B.b once the const-generic Executor<MAX_HANDLES, MAX_SC> reshape is sorted.

Structs§

AtomicSporadicState
Phase 110.E.b — 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 &mut access.
OptUs
Optional time field with a sentinel 0 for “absent”.
SchedContext
First-class scheduling capability — one SC per scheduling concern, shared by every callback that should run under the same budget / period / deadline / class.
SchedContextId
Identifier for a SchedContext registered with an Executor. 110.B.b adds storage [Option<SchedContext>; MAX_SC]; this index addresses into that array.
SporadicState
Phase 110.E — user-space sporadic-server runtime state.
TimeTriggeredSchedule
Fixed-size, no_std-friendly cyclic schedule. N is the declared maximum window count; window_count is the active length (callers can build the array up to N and set window_count to the actual size used).
TimeTriggeredWindow
One slot in a time-triggered schedule.

Enums§

DeadlinePolicy
How an EDF deadline is interpreted relative to a callback firing.
Priority
Criticality bucket for SchedContext. Phase 110.C uses this to pick which BucketedFifoSet / BucketedEdfSet slot a callback dispatches through; later phases (110.D) map it to OS priority.
SchedClass
Scheduling class — picks the runtime queue + selection policy for the contained callbacks.
TimeTriggeredScheduleError
Validation errors for a TimeTriggeredSchedule.

Functions§

atomic_sporadic_refill_thunk
C-callable refill thunk that PlatformTimer::create_periodic invokes from the platform’s timer context. Single atomic store — safe in any thread / ISR context.