Expand description
Deterministic event loop scheduler for PiJS runtime.
Implements the spec from EXTENSIONS.md §1A.4.5:
- Queue model: microtasks (handled by JS engine), macrotasks, timers
- Timer heap with stable ordering guarantees
- Hostcall completion enqueue with stable tie-breaking
- Single-threaded scheduler loop reproducible under fixed inputs
§Invariants
- I1 (single macrotask): at most one macrotask executes per tick
- I2 (microtask fixpoint): after any macrotask, microtasks drain to empty
- I3 (stable timers): timers with equal deadlines fire in increasing seq order
- I4 (no reentrancy): hostcall completions enqueue macrotasks, never re-enter
- I5 (total order): all observable scheduling is ordered by seq
Structs§
- Deterministic
Clock - A deterministic clock for testing.
- Hugepage
Config - Configuration for hugepage-backed slab allocation.
- Hugepage
Status - Hugepage availability snapshot from the host.
- Macrotask
- A macrotask in the queue.
- Numa
Slab - Per-NUMA-node slab with free-list recycling.
- Numa
Slab Config - Configuration for a NUMA-local slab pool.
- Numa
Slab Handle - Handle returned on successful slab allocation.
- Numa
Slab Node Telemetry - Per-node telemetry counters.
- Numa
Slab Pool - Multi-node slab pool that routes allocations to NUMA-local slabs.
- Numa
Slab Telemetry - Aggregate slab pool telemetry.
- Reactor
Backpressure - Backpressure signal for rejected mesh enqueue operations.
- Reactor
Envelope - Per-envelope metadata produced by
ReactorMesh. - Reactor
Mesh - Deterministic multi-shard reactor mesh using bounded per-shard SPSC lanes.
- Reactor
Mesh Config - Configuration for
ReactorMesh. - Reactor
Mesh Telemetry - Lightweight telemetry snapshot for mesh queueing behavior.
- Reactor
Placement Manifest - Machine-readable shard placement manifest.
- Reactor
Shard Binding - Deterministic shard binding produced by placement planner.
- Reactor
Topology Core - Core descriptor used by topology-aware shard placement.
- Reactor
Topology Snapshot - Lightweight machine-provided topology snapshot.
- Scheduler
- The deterministic event loop scheduler state.
- Seq
- Monotonically increasing sequence counter for deterministic ordering.
- Thread
Affinity Advice - Advisory thread-to-core binding produced from placement manifest.
- Timer
Entry - A timer entry in the timer heap.
- Wall
Clock - Real wall clock implementation.
Enums§
- Affinity
Enforcement - Enforcement level for thread-to-core affinity.
- Cross
Node Reason - Cross-node allocation reason for telemetry.
- Hostcall
Outcome - Outcome of a hostcall.
- Hugepage
Fallback Reason - Reason why hugepage-backed allocation was not used.
- Macrotask
Kind - Type of macrotask in the queue.
- Reactor
Placement Fallback Reason - Explicit fallback reason emitted by topology planner.
Traits§
- Clock
- A monotonic clock source for the scheduler.