shadow::wide woke every kept thread (4 on 16 hardware threads) for each
call, however few its jobs: a submission's refresh_front with 2 copies to
refresh woke 4 threads, 3 of which found nothing and slept again. Waking
is a system call per thread on the calling thread
(NtAlertThreadByThreadIdEx, 2.4% of the submitting thread's samples in
profile-y-prof60, 1.3% under shadow::wide), and the threads woken for
nothing take processor time from the others on a machine where ready
threads already wait to run ("woken, not running yet" 1.4-6.1 ms of the
frame's chain in timeline tl.170).
Now one thread is woken for each job beyond the one the caller takes,
all of them only when there are jobs for all. A thread busy meanwhile
looks at the queue before it sleeps, and the caller takes every job
nobody took, as before, so no job waits for a thread.
Behaviour-neutral: the same jobs run, on the same threads. On by default,
no switch.
Co-Authored-By: Claude Opus 5.5 <[email protected]>