feat(scheduler-core): implement builtin_fcfs session and post-allocation hooks (task 2.3)
Adds begin_session/next_job/end_session/on_dispatch/on_pend, driving a dual-cursor walk (queue then job) over builtin_fcfs's private ordq_t state. next_job() returns candidates in (queue priority desc, job priority desc, queue_time asc) order and NULL once exhausted; on_dispatch removes permanently, on_pend is a true no-op. Review flagged an unsynchronized cross-thread access risk between next_job() (picker thread) and on_dispatch/on_pend (allocator thread) once wired live in task 2.4 — recorded in tasks.md Implementation Notes for that task to close before registering builtin_fcfs as the default. Requirements: 3.2, 3.4, 3.6
This commit is contained in:
parent
b7214ebe88
commit
fcb32a8b30
5 changed files with 658 additions and 8 deletions
|
|
@ -104,6 +104,20 @@ sched_picker_fcfs_test = executable('sched_picker_fcfs_test',
|
|||
dependencies: [scheduler_test_deps],
|
||||
install: false)
|
||||
|
||||
# White-box test for builtin_fcfs's session hooks (begin_session/next_job/
|
||||
# end_session) and post-allocation hooks (on_dispatch/on_pend) (scheduler-core
|
||||
# spec, task 2.3). Split out of test_picker_fcfs.c rather than appended to it
|
||||
# -- that file was already ~765 lines after tasks 2.1/2.2, against this
|
||||
# project's 800-line ceiling. Also #includes ../src/plugins/builtin_fcfs.c
|
||||
# directly (same white-box pattern as sched_picker_fcfs_test), and supplies
|
||||
# its own sched_queue_is_ready()/sched_job_is_ready() test doubles since this
|
||||
# translation unit does not link scheduler.c (see the file header comment).
|
||||
sched_picker_fcfs_session_test = executable('sched_picker_fcfs_session_test',
|
||||
['test_picker_fcfs_session.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',
|
||||
|
|
@ -124,3 +138,5 @@ test('scheduler picker config fields test', sched_picker_config_fields_test, sui
|
|||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler picker fcfs test', sched_picker_fcfs_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
test('scheduler picker fcfs session test', sched_picker_fcfs_session_test, suite: 'scheduler',
|
||||
env: ['ASAN_OPTIONS=detect_leaks=0'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue