Superior Cache Locality with LIFO/FIFO Strategy
Work-stealing enhances cache locality by having workers process tasks from their local LIFO queues, which often share data, and only stealing older, less cache-critical tasks (FIFO) from other workers when idle.
The top 3
- LIFO's Cache Affinity for Local Tasks: Worker threads prioritize local tasks using a Last-In, First-Out (LIFO) order, which is highly cache-friendly. This ensures recently created tasks, often processing recently-touched data, remain in fast CPU caches, promoting depth-first execution and minimizing cache misses.
- FIFO Steals Target Coarsest Tasks: When an idle worker 'steals' work from another, it uses a First-In, First-Out (FIFO) approach from the victim's deque. This strategy intentionally targets the oldest and typically most coarse-grained tasks, minimizing the number of subsequent steals and reducing inter-processor communication.
- Work-Stealing: Contention Reduction & Optimality: This dual LIFO/FIFO strategy in work-stealing schedulers minimizes contention by allowing local, lock-free operations for most tasks. This design, pioneered by Cilk, ensures excellent cache locality, eliminates central coordination bottlenecks, and achieves near-optimal speedup for parallel-recursive workloads.
Sources
Open the full topic