Phase 3: structured tasks and the deterministic scheduler (RFC 0011)
- interpreter core rewritten around explicit per-task frame stacks so a task can be suspended at any instruction; behavior of all existing tests unchanged - tasks: scope and task<T> (function-bound; task_transfer and task_borrow_returns reserved), spawn/join/cancel/cancelled/scope.end; cooperative scheduler with seeded choice rule, separate schedule seed, quantum = fuel unit, task limit (limit_exceeded kind tasks), global quiescence over waiting tasks; schedule field in the run record - verifier: Send/Share table (E4001, E4002), loans as task-owned borrows (E4302 on early end, E4101 on conflicts), E4301 at scope end, task effects (E3101) - CLI --quantum, --task-limit, --schedule-seed; runner schedules:, quantum:, task_limit:, limit_exceeded: - fixed: schedule seed default used orelse/^ precedence wrongly - 15 phase-3 conformance tests; 4000 mutants without a crash - Agent Reference Bundle +10.9 % tokens (recorded)
This commit is contained in:
1 parent
2289917af3
commit
ab5814a7bb
31 files changed
+1252
-94
No files matched your search
@@ -43,5 +43,6 @@ Growth never blocks a merge automatically; a complex feature can be justified, b
|
||||
| Milestone | Files | Sections | Bytes | Words | cl100k | o200k | Qwen2.5 |
|
||||
|---|---:|---:|---:|---:|---:|---:|---:|
|
||||
| Phase 2 baseline (AIR format 0) | 18 | 29 | 104 250 | 16 197 | 27 347 | 27 445 | 28 230 |
|
||||
| RFC 0011 tasks (Phase 3, part 1) | 19 | 33 | 116 126 | 18 082 | 30 333 (+10.9 %) | 30 433 (+10.9 %) | 31 316 (+10.9 %) |
|
||||
|
||||
Next measurement: after Phase 3 (structured concurrency).
|
||||
RFC 0011 crossed the 10 % warning line (its own estimate said "below 10 %"): four new sections in spec 04 (tasks, loans, `Send`/`Share` table, scheduler). Below the 20 % review threshold. Next measurement: after RFC 0012 (channels, synchronization).
|
||||
@@ -14,5 +14,21 @@
|
||||
"o200k_base": 27445,
|
||||
"qwen2.5": 28230
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "rfc-0011 tasks (Phase 3, part 1)",
|
||||
"language": "aji",
|
||||
"air": 0,
|
||||
"phase": 2,
|
||||
"files": 19,
|
||||
"sections": 33,
|
||||
"bytes": 116126,
|
||||
"lines": 1777,
|
||||
"words": 18082,
|
||||
"tokens": {
|
||||
"cl100k_base": 30333,
|
||||
"o200k_base": 30433,
|
||||
"qwen2.5": 31316
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -22,19 +22,19 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
|
||||
| ID | Status | Task | Depends | Output | Done when |
|
||||
|---|---|---|---|---|---|
|
||||
| P3-1 | todo | Resolve Q-013, Q-014; propose RFC 0002 for acceptance | — | spec 04, 11 | questions resolved |
|
||||
| P3-2 | todo | Contract tables: `task.*`, `thread.*`, `channel.*`, `mutex.*`, `rwlock.*`, select | P3-1 | spec 07 appendix | all spec 07 §4 fields including synchronization effects |
|
||||
| P3-2a | todo | Publish features `tasks`, `channels`, `sync` | P3-2 | `reference/air-features.md`, `src/air/features.zig` | feature_not_declared / missing_dependency tests |
|
||||
| P3-3 | todo | Deterministic scheduler: seeds, choice points, choice log; global fuel across tasks and a separate `quantum` (spec 11 §7.2) | P3-2 | `src/interp/sched.zig` | same seed ⇒ identical trace; choice log replays a run; fuel is the sum over all tasks |
|
||||
| P3-4 | todo | Send/Share/Local derivation | P3-1 | `src/verifier/send_share.zig` | E4001, E4002 accept/reject |
|
||||
| P3-5 | todo | Task-scope verifier and scoped borrows | P3-2 | `src/verifier/tasks.zig` | E4301, E4302 accept/reject |
|
||||
| P3-6 | todo | Concurrent alias / data-race rejection | P3-5 | `src/verifier/borrow.zig` | E4101 accept/reject; disjoint `split_mut` halves accepted in two tasks |
|
||||
| P3-7 | todo | Interpreter tasks: spawn, join, cancel, cancellation points, shields, task failure | P3-3 | `src/interp/` | cancellation observed only at defined points; shield defers it |
|
||||
| P3-1 | doing | Resolve Q-013, Q-014; propose RFC 0002 for acceptance (Q-014 resolved by RFC 0011; Q-013 with RFC 0012) | — | spec 04, 11 | questions resolved |
|
||||
| P3-2 | doing | Contract tables: `task.*` (RFC 0011, done), `channel.*`, `mutex.*`, `rwlock.*`, select (RFC 0012); `thread.*` deferred to native backends | P3-1 | spec 07 appendix | all spec 07 §4 fields including synchronization effects |
|
||||
| P3-2a | doing | Publish features `tasks` (done), `channels`, `sync` | P3-2 | `reference/air-features.md`, `src/air/features.zig` | feature_not_declared / missing_dependency tests |
|
||||
| P3-3 | done | Deterministic scheduler: seeds, choice points, choice log; global fuel across tasks and a separate `quantum` (spec 11 §7.2) | P3-2 | `src/interp/sched.zig` | same seed ⇒ identical trace; choice log replays a run; fuel is the sum over all tasks |
|
||||
| P3-4 | done | Send/Share/Local derivation | P3-1 | `src/verifier/send_share.zig` | E4001, E4002 accept/reject |
|
||||
| P3-5 | done | Task-scope verifier and scoped borrows | P3-2 | `src/verifier/tasks.zig` | E4301, E4302 accept/reject |
|
||||
| P3-6 | done | Concurrent alias / data-race rejection | P3-5 | `src/verifier/borrow.zig` | E4101 accept/reject; disjoint `split_mut` halves accepted in two tasks |
|
||||
| P3-7 | doing | Interpreter tasks: spawn, join, cancel, cancellation points, shields, task failure | P3-3 | `src/interp/` | cancellation observed only at defined points; shield defers it |
|
||||
| P3-8 | todo | Bounded and rendezvous channels with ownership transfer | P3-7 | interpreter + verifier | sender cannot use moved message (E2001); capacity 0 rendezvous test |
|
||||
| P3-9 | todo | Mutex and RwLock with linear guards | P3-7 | interpreter + verifier | guard not `Send`; unlock consumes guard; E3002 on leaked guard |
|
||||
| P3-10 | todo | Async I/O buffer claims | P3-7 | verifier + runtime | E4303 accept/reject |
|
||||
| P3-11 | todo | Blocking effect and blocking pool policy | P3-7 | spec 04 §18, runtime | `thread.block` from ordinary task handled per spec |
|
||||
| P3-12 | todo | Runner: `seed:`/`schedules:`/`quantum:` headers (schedule budget kept separate from fuel); stress modes (1/2/N workers, random, forced yield, slow consumer, cancellation during waits, I/O reordering) | P3-3 | `tools/conformance.zig` | stress modes selectable; failing seed printed for replay |
|
||||
| P3-12 | doing | Runner: `seed:`/`schedules:`/`quantum:` headers (schedule budget kept separate from fuel); stress modes (1/2/N workers, random, forced yield, slow consumer, cancellation during waits, I/O reordering) | P3-3 | `tools/conformance.zig` | stress modes selectable; failing seed printed for replay |
|
||||
| P3-13 | todo | Reference programs: parallel-map, channel transfer, tcp-echo with tasks | P3-8, P3-9 | `tests/programs/` | pass under all stress modes |
|
||||
| P3-14 | todo | Phase exit review | all | plan status | exit criterion passes |
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
Status: Accepted (revision 2, after owner review items 1–10)
|
||||
Scope: AIR format 0, feature `tasks`
|
||||
Language version: 0.1
|
||||
Measured Agent Reference Bundle growth on integration: +10.9 % tokens (estimate in this RFC: below 10 %).
|
||||
Integrated into: spec 04 §33–§36; spec 02 §6; spec 07a; spec 08 §14; spec 11 §7.2; `reference/air-features.md`; `docs/agent/bundle.txt`
|
||||
Supersedes: —
|
||||
|
||||
|
||||
Reference in new issue
Block a user