Work Stealing: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
=External= | |||
* "Concurrency in Go" by Katherine Cox-Buday, Chapter 6. Goroutines and the Go Runtime | |||
=Internal= | =Internal= | ||
* [[Job Scheduling]] | * [[Job Scheduling]] | ||
Line 4: | Line 6: | ||
=Overview= | =Overview= | ||
The work stealing goroutine scheduling follows the following basic rules: | The work stealing goroutine scheduling follows the following basic rules: | ||
# At a fork point, add tasks to the tail of the duque | # 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. |
Revision as of 19:17, 26 February 2024
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.