M:N cooperative fiber scheduler
Platform spec ADR
M:N cooperative fiber scheduler
Spec standingStandard
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Context
Section titled “Context”Beskid rejects Rust-style async/await state machines at the language level (D-INC-0008). The runtime must provide cooperative concurrency primitives consumed by corelib_concurrency.
Decision
Section titled “Decision”| Rule | Detail |
|---|---|
| Model | M:N — many fibers on a pool of OS worker threads |
| API surface | fiber_* builtins back `Fiber<T>`; no async lowering in compiler |
| Preemption | User fibers are cooperative; preemptive parallelism uses System.Threading (OS threads) |
| Work stealing | Per-worker run queues; work-stealing permitted |
| Parking | Fibers park on channel ops, join, cancel, and blocking syscalls |
Consequences
Section titled “Consequences”Scheduler modules live under beskid_runtime/src/scheduler/. Deprecated rt_yield (sched feature) is superseded by fiber_yield.
Verification anchors
Section titled “Verification anchors”compiler/crates/beskid_runtime/tests/concurrency.rs; corelib concurrency tests; git: 12ee673, 76a58f5.