Skip to main content

Phase 9. Streams, agents, M:N scheduler

FieldValue
MEPMEP-45 §Phases · Phase 9
StatusNOT STARTED
Started
Landed
Tracking issue
Tracking PR

Gate

Streams + agents fixture suite (~40 cases: stream emit/subscribe, agent intent dispatch, bounded channel back-pressure, shutdown, fan-out fan-in) compiles + runs byte-equal vs vm3 on host triple under TSan-clean execution.

Goal-alignment audit

To be written before sub-phase 9.0 starts. Streams + agents differentiate Mochi from other small languages; agent-style programs need this surface to compile. Aligns.

Sub-phases

#ScopeStatusCommitPR
9.0M:N work-stealing scheduler over minicoro; one OS thread per hardware core; blocking syscalls on overflow poolNOT STARTED
9.1chan<T>: bounded ring, point-to-point, send blocks when fullNOT STARTED
9.2stream<T>: bounded ring + subscriber list (MPMC broadcast); emit blocks when any subscriber fullNOT STARTED
9.3Agent: record with embedded mailbox; intent calls enqueue typed messages; run loop on dedicated fiberNOT STARTED
9.4Shutdown protocol: graceful drain on SIGINT/SIGTERM; bounded-time hard kill after timeoutNOT STARTED

Decisions made

Fill in along the way.

Deferred work

CPU preemption (Go-style signal preemption): v2.

Closeout notes

Fill in after gate green.