feat(scheduler-sim-live-allocation): wire simulation mode onto shared picker/allocator (task 4.1)
Replaces sim_picker_thread_fn() (the always-PEND placeholder) with the real sched_job_picker()/sched_allocator() threads (task 3.1), spawned against &(sim->core) in sched_sim_driver_run(). Simulation mode now genuinely uses the jbuf capacity-1 rendezvous for the first time (confirmed still exactly one producer/one consumer). Adds sched_election.c to sched_sim_isolation_lib. Fixes bug-1829 (blocking, only reachable once sim_allocator() actually called sched_make_allocation() for the first time): core->seqjob_ allocator/parjob_allocator were never bootstrapped for simulation mode at all. Fixed via new sim_alloc.c (sim_bootstrap_seqjob_allocator()/ sim_bootstrap_parjob_allocator()), mirroring the sim_picker.c/ sim_limit.c precedent. That fix's own workaround -- a throwaway xce_scheduler_t wrapper satisfying seqjob/parjob's init_fn -- has a documented, narrow side effect: prepare_allocation_hook fan-out during a live seqjob/parjob dispatch attempt reaches the wrapper's own separate plugin registry, not sim->core.plugins, so a plugin registered only against the real sim core (the limit plugin) isn't reached for host-scoped matching during a live dispatch yet. Documented in design.md's new "Known Seam Gap" section; task 4.3 added to tasks.md to close it before task 5.2's acceptance test can pass for the host-scoped case. TDD: new end-to-end test drives a real .replay with an empty decisions array (ruling out reconciliation) through the real thread pair, proving a genuine DISPATCH from live resource availability. 25 pre-existing white-box sim/repl test files given link-satisfying stubs reproducing the OLD always-PEND contract unchanged -- their own assertions are untouched (task 5.3's job to reconcile deeper). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
parent
4195331b47
commit
08df64930b
33 changed files with 3809 additions and 92 deletions
|
|
@ -19,6 +19,7 @@ scheduler_srcs = [
|
|||
'src/sim_loop.c',
|
||||
'src/sim_picker.c',
|
||||
'src/sim_limit.c',
|
||||
'src/sim_alloc.c',
|
||||
'src/sim_verify.c',
|
||||
'src/sim_record.c',
|
||||
'src/repl.c',
|
||||
|
|
@ -102,8 +103,8 @@ sched_core_isolation_lib = static_library(
|
|||
# the simulation driver's own files, consumed by
|
||||
# testsuite/test_sim_isolation.c to prove at build time that
|
||||
# sim.c/sim_loop.c/sim_record.c/repl.c/repl_fmt.c/repl_break.c/repl_info.c/
|
||||
# repl_params.c/sim_picker.c/sim_limit.c reference zero controller-facing
|
||||
# symbols (client/netio/xceapi/delay/idgen). All files are compiled
|
||||
# repl_params.c/sim_picker.c/sim_limit.c/sched_election.c reference zero
|
||||
# controller-facing symbols (client/netio/xceapi/delay/idgen). All files are compiled
|
||||
# together into ONE archive -- task 11.2 added sim_loop.c as a sibling
|
||||
# file to task 11.1's sim.c, task 11.5 added sim_record.c as a third, task
|
||||
# 12.1 added repl.c as a fourth, task 12.2 added repl_break.c/repl_info.c
|
||||
|
|
@ -126,13 +127,43 @@ sched_core_isolation_lib = static_library(
|
|||
# core_clock.c) never-mechanically-covered gap for the sim driver, which is
|
||||
# exactly the omission a prior round of this same task left in place by
|
||||
# adding sim_limit.c to scheduler_srcs above without also adding it here.
|
||||
# scheduler-sim-live-allocation spec's task 4.1 adds sched_election.c as an
|
||||
# eleventh: sim_loop.c's sched_sim_driver_run() now calls sched_job_picker()/
|
||||
# sched_allocator() (sched_election.c) directly, no longer the file's own,
|
||||
# now-removed sim_picker_thread_fn() -- the same "cover every file the
|
||||
# driver's own compiled object actually calls" rationale sim_picker.c/
|
||||
# sim_limit.c's own additions above already establish. Task 3.1 (which
|
||||
# relocated sched_job_picker()/sched_allocator() out of scheduler.c into
|
||||
# this new file) deliberately deferred this addition to task 4.1, since
|
||||
# sim_loop.c did not yet call either function until this task wired the
|
||||
# real spawn in.
|
||||
# Same "compiling to an object is enough, no real linking needed" rationale
|
||||
# as sched_core_isolation_lib above.
|
||||
# as sched_core_isolation_lib above -- sched_election.c's own undefined
|
||||
# references (sched_make_allocation()/sched_commit_decision(), scheduler.c)
|
||||
# are themselves already core-safe (verified by task 3.1's own fixture) and
|
||||
# remain undefined in this archive exactly like every other cross-file call
|
||||
# already does; nm(1)'s FORBIDDEN_SYMBOLS check (test_sim_isolation.c) only
|
||||
# flags controller-facing names, none of which sched_election.c references.
|
||||
# Task 4.1 also adds sim_alloc.c as a twelfth (bug-1829 fix): sim_loop.c now
|
||||
# also calls sim_bootstrap_seqjob_allocator()/sim_bootstrap_parjob_
|
||||
# allocator() (sim_alloc.c), the same "cover every file the driver's own
|
||||
# compiled object actually calls" rationale as sched_election.c immediately
|
||||
# above. sim_alloc.c #includes scheduler.h (for the throwaway xce_scheduler_t
|
||||
# wrapper its own file header comment explains) -- safe here for the exact
|
||||
# same reason sched_election.c's own scheduler.h include is safe: this file
|
||||
# is not part of test_sim_isolation.c's own enumerated text-scan list (that
|
||||
# list only ever covered sim.h/sim.c/sim_loop.c/sim_picker.c/sim_record.c/
|
||||
# repl.c/repl.h/repl_break.c/repl_info.c/repl_internal.h/repl_params.c, never
|
||||
# extended to sim_limit.c or sched_election.c either), and its own compiled
|
||||
# object references zero controller-facing symbols (register_seqjob_
|
||||
# allocator()/register_parjob_allocator(), plugins/seqjob_allocator.c and
|
||||
# plugins/parjob_allocator.c, touch only core-scoped resource/worker state).
|
||||
sched_sim_isolation_lib = static_library(
|
||||
'sched_sim_isolation',
|
||||
['src/sim.c', 'src/sim_loop.c', 'src/sim_picker.c', 'src/sim_limit.c',
|
||||
'src/sim_record.c', 'src/repl.c', 'src/repl_fmt.c', 'src/repl_break.c',
|
||||
'src/repl_info.c', 'src/repl_params.c', 'src/repl_rollup.c'],
|
||||
'src/sim_alloc.c', 'src/sim_record.c', 'src/repl.c', 'src/repl_fmt.c',
|
||||
'src/repl_break.c', 'src/repl_info.c', 'src/repl_params.c',
|
||||
'src/repl_rollup.c', 'src/sched_election.c'],
|
||||
include_directories: incdir,
|
||||
dependencies: scheduler_deps,
|
||||
install: false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue