Steal waiting work
This deterministic authored scheduler represents web-service handlers; it is not the Go runtime algorithm or a native scheduling measurement. One line is request <name> <step> ... or run <processors>. Names match [A-Za-z_][A-Za-z0-9_]* and are unique per batch; steps are cpu or io<k> with integer k in 1..16 (no zero-duration I/O). Easy uses cpu only. Each run takes 1..8 processors, at most 12 requests and 32 steps per request, with total CPU steps plus all I/O durations at most 128 per batch. At most 128 commands and 8192 ASCII bytes per line; ordinary I/O/allocation completes. Empty requests and empty batches are supported. Finish each declared batch with run. Initial queues use declaration index modulo processor count. A tick first wakes waits in parking order, then visits processors in ascending order; each executes at most one cpu step. Completed waits do not requeue. Empty selected requests retire without a CPU step; a final wake tick can print idle. The supplied loop cap is 200 ticks, above the supported correct workload. A no-tick batch prints schedule: with no trailing space. These tick, wake, donor and home-queue rules are model contracts, not guaranteed real-Go scheduling.
What needs to change
Change pick so no processor sits idle while requests queue on another.
Reproduce
- Run the sample: the C++ program reads five short requests, then run 2. Compare the schedule it prints.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
Wake-ups and parking are supplied. pick receives the idle Proc and every processor; queue is a std::deque. The lab compiles with g++ -std=c++23.