Work Stealing
Jump to navigation
Jump to search
External
- "Concurrency in Go" by Katherine Cox-Buday, Chapter 6. Goroutines and the Go Runtime
Internal
Overview
The work stealing goroutine scheduling follows the following basic rules:
- At a fork point, add tasks to the tail of the duque associated with the thread.
- If the thread is idle, steal work from the head of deque associated with some other random thread.
- At a join point that cannot be realized (for example, the goroutine it is synchronized with has not completed yet), pop work off the tail of the thread's own duque.
- If the thread's deque is empty, either stall at a join or steal work from the head of a random thread's associated duque.