feat(scheduler-core): implement simulation event loop and virtual clock advancement (task 11.2)
Add sim_loop.c implementing sched_sim_driver_run(): decode .replay messages in file order, jump the virtual clock to each ReplayEvent's exact timestamp as it's queued, and run a real push-events/go/drain/ end-session cycle on each ReplaySession boundary (AC 14, AC 18). Task 11.1 left no picker registered against the isolated core and no thread backing its cbufs, which deadlocks the decision drain the moment a real event loop exists. Add plugin_register_core() (registers a picker against a bare xce_sched_core_t*, no xce_scheduler_t* required) and extract builtin_fcfs_new_plugin() from register_builtin_fcfs() as a behavior-preserving factory, plus a picker-driving thread for the sim driver. Since real resource allocation is unreachable without a live xce_scheduler_t* (scheduler-allocation spec's job), the sim picker thread conservatively PENDs every candidate rather than dispatching. 28/28 scheduler suite, 32/32 whole-project tests green.
This commit is contained in:
parent
5d587ecf32
commit
7e1e861e4f
11 changed files with 1248 additions and 76 deletions
|
|
@ -479,6 +479,28 @@ sched_sim_startup_test = executable(
|
|||
dependencies: [scheduler_test_deps],
|
||||
install: false)
|
||||
|
||||
# Contract test for the simulation-mode event loop and virtual clock
|
||||
# advancement (scheduler-core spec, task 11.2, Req 5 AC 14/18): the virtual
|
||||
# clock jumps to each ReplayEvent's own timestamp, in exact file order
|
||||
# (including a same-timestamp pair), at the moment it is queued; each
|
||||
# ReplaySession boundary triggers one complete push-events ->
|
||||
# start-session -> drain-decisions -> end-session round, in file order
|
||||
# across multiple rounds. Same white-box #include pattern as
|
||||
# sched_sim_startup_test (core.c, core_clock.c, recording.c, sim.c,
|
||||
# snapshot.c/snapshot_wire.c/snapshot_load.c) PLUS core_events.c,
|
||||
# core_session.c, decision.c (the real session/decision machinery this
|
||||
# task's event loop drives) PLUS plugin.c, plugins/builtin_fcfs.c (task
|
||||
# 11.2's own new core.h-scoped picker registration path,
|
||||
# plugin_register_core()/builtin_fcfs_new_plugin() -- deliberately NOT
|
||||
# schedobj.c, which needs a genuine xce_scheduler_t* this driver has none
|
||||
# of, Req 5 AC 17) PLUS the new ../src/sim_loop.c under test.
|
||||
sched_sim_event_loop_test = executable(
|
||||
'sched_sim_event_loop_test',
|
||||
['test_sim_event_loop.c'],
|
||||
include_directories:[incdir],
|
||||
dependencies: [scheduler_test_deps],
|
||||
install: false)
|
||||
|
||||
# Register as meson tests so `meson test --suite scheduler` runs them all.
|
||||
# detect_leaks=0 matches the suite convention (fixtures are not torn down).
|
||||
test('scheduler test', scheduler_test, suite: 'scheduler',
|
||||
|
|
@ -551,3 +573,6 @@ test('scheduler admin request test',
|
|||
test('scheduler sim startup test',
|
||||
sched_sim_startup_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler sim event loop test',
|
||||
sched_sim_event_loop_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue