Suppose a thread in a work-stealing scheduler is idle and looking for the next task to run. To find an available task, it might do the following:
- Try popping one task from the local worker queue.
- Try popping and stealing tasks from another local worker queue.
- Try popping and stealing a batch of tasks from the global injector queue.
An implementation of this work-stealing strategy:
Examples
use WorkStealQueue;
let queue = new;
queue.push;
queue.push;
let local0 = queue.local_queue;
local0.push_back;
local0.push_back;
local0.push_back;
local0.push_back;
let local1 = queue.local_queue;
local1.push_back;
local1.push_back;
for i in 0..8
assert_eq!;
assert_eq!;
assert_eq!;