* Distribute tasks in a round-robin fashion.
* Required APIs:
void task::spawn_root_and_wait(taks&);
void task::spawn(task&);void task::spawn_and_wait_for_all(task&);Depth-first execution:
* Strike when the cache is hot. The deepest tasks are the most recently created tasks, and therefore arehottest in cache.
* Minimize space. Depth-first execution creates nodes linearly.Breadth-first execution:
* Maximize parallelism.Eah thread has its own task queue. When a thread spawns a task, it pushes it onto the bottom of its queue. (top:
oldest task, bottom: youngest task)
A thread continually executes a task obtained by the first rule below that applies:
1. Pop a task from the bottom of its own queue. This rule does not apply if the queue is empty. (depth-firstexecution)
2. Steal a task from the top of another randomly chosen queue. If the chosen queue is empty, the thread triesthis rule again until it succeeds. (breadth-first execution)
posted on 2012-06-22 21:33 阅读( ...) 评论( ...)