concurrency: the skewed-cost benchmark and the measurements of section 9 #6
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Close the gate of CONCURRENCY.md slice H: a skewed-cost benchmark of the worker pool, and the three measurements of section 9, taken and written into the design record. The inbox and the stealing of unstarted tasks are built; nothing yet shows that they balance a skewed load.
Source
Pinned at
a022d2a8af1d27cb5a07f2a79be68a2ee5f7d12b(main):spawnto first run (median and 99th percentile), and the skewed-cost gate.tools/gates.sh: PERFORMANCE.md section 6, "A benchmark ratio budget" and benchmarks/README.md.No ROADMAP milestone is sliced here beyond the record's own slice H, and CONCEPT "Open Questions" has nothing on scheduling or stealing.
What exists, what does not
torb_pool_statistics_now()(runtime/include/torb_task.h) countsresumedandstolen, summed over workers. It is C-only: no.trbprogram can read it, and this issue does not change that.runtime/tests/pool_test.calready starts N hand-written state-machine tasks of a given cost from the main thread (run_works) and assertsstolengrows. Use it as the model for the harness.benchmarks/parallel.shmeasuresparallel()speed-up; it does not look at tasks of uneven cost.Decisions made here (so the implementer does not have to ask)
benchmarks/(for examplebenchmarks/pool-skew.candbenchmarks/pool.sh, shaped likeparallel.sh), linking the sourcesruntime/build.shlists.TORB_POOL_MEASURE) that only the harness sets, so the default build, the emitted programs and the seed's copy of the runtime pay nothing. The macro adds one record intask.cplus a reader function next totorb_pool_statistics_now; it is declared as test/benchmark-only liketorb_pool_set_workers.max(total cost / W, cost of the longest task), withWthe worker count; cost is measured by running the same tasks on one worker. Stated factor: 1.5 of the ideal split, hard bound 2.0. If the median of five runs on a machine with at least four cores is within 1.5, state 1.5 in section 9. If it lands between 1.5 and 2.0, state the measured factor rounded up and say why. Above 2.0 the implementer does not loosen the gate or change the stealing silently: the PR (or a comment on this issue) reports the numbers and the item waits for an owner decision.run.shit is a measurement on a machine the record names (processor, logical cores, OS), exits non-zero past the factor only when asked (for exampleGATE=1), is not wired intotools/gates.sh,.forgejo/workflows/or the website's benchmark report, and a forge runner shared with other jobs is not the reference. Wiring it into a workflow is a separate, later change.stolen / N; a started task never moves, so a steal before first run is exactly "ran on a worker other than the one that spawned it" for the spawn loop.Acceptance criteria
TORB_WORKERS/ thetorb_pool_set_workerspath ofpool_test.c) and prints: wall time, the ideal split, their ratio, and PASS/FAIL against the factor.runtime/compiles to the same behaviour:sh runtime/build.shis green, no new field or branch on a default hot path beyond what the macro guards, and the live-block counter is zero after every harness run.pool_test.cone_worker_runs_everything_on_the_main_thread).task.c, drop the control and say so in the PR.docs/PERFORMANCE.mdorbenchmarks/README.mdgets a row/paragraph for the new script, saying it is a measurement.sh tools/gates.sh abgreen in the worktree (the change touchesruntime/, so tier B applies), or the forge CI of the PR green and stated so.tools/check-commits.shclean; docs changes regenerateskills/asCLAUDE.mdasks.Seed
Does not touch the seed: no syntax change, no new native, no driver flag, no std name the compiler looks up by string.
seed/is not touched.Size and commits
One PR, two Conventional Commits:
feat(runtime): measure the pool's queues, thefts and start latency(the macro-guarded instrumentation and its unit test inruntime/tests/pool_test.c).feat(benchmarks): a skewed-cost benchmark of the worker pool(the harness, the script, the numbers in CONCURRENCY.md section 9 and slice H, the README/PERFORMANCE row, regeneratedskills/).Suggested implementer: opus/high (
runtime/task.clocking order and a hot path are involved).Dependencies and collisions
main.docs/design/CONCURRENCY.mdtoo (slice F's status note and gaps 4/5), in other regions than section 9, slice H and "The pool, as built"; expect at most a trivial rebase in the file. They touch no runtime file.Window) is checker/std work and does not touch the pool.[loop:torbscript] intake: in scope (author orion, label loop). Completes CONCURRENCY.md slice H (gate: skewed-cost benchmark plus the section 9 measurements); no collision with CONCEPT "Open Questions", no seed impact expected. Measurements need a stable runner, to settle in refine. Release freeze for 0.1.0 (2026-10-06) holds new PRs, next: refine (queued, buffer >= 2 ready)
[loop:torbscript] claim refine by session:loop-torbscript-20261008 until 2026-10-08T00:11:50Z
[loop:torbscript] refine: body rewritten to the definition of ready (goal, pinned sources in CONCURRENCY.md section 9 / slice H, C-level harness with macro-guarded instrumentation and no public surface, stated factor 1.5 with hard bound 2.0, not a CI gate, no seed impact, one PR in two commits, implementer opus/high; no collision with #4, #155, #156), label ready set, worker usage ~75k tokens, next: implement
[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T06:31:58Z
[loop:torbscript] implement: resumed after the previous worker was stopped by a restart; head
6023207874unchanged (two Conventional Commits,tools/check-commits.shclean, mergeable without rebase), review requested from argus, PR #169, CI green (tier A, tier B, gates, bootstrap linux-x64, every host emits the same C; platform jobs skipped by path filter), worker usage ~45k tokens, next: review