Work Stealing: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
Line 4: Line 4:
* [[Job Scheduling]]
* [[Job Scheduling]]
* [[The_Job_Scheduling_Problem#Overview|The Job Scheduling Problem]]
* [[The_Job_Scheduling_Problem#Overview|The Job Scheduling Problem]]
* [[Go_Runtime#Goroutine_Management|Go Runtime]]
=Overview=
=Overview=
The work stealing goroutine scheduling follows the following basic rules:
The work stealing goroutine scheduling follows the following basic rules:

Latest revision as of 19:21, 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:

  1. At a fork point, add tasks to the tail of the duque associated with the thread.
  2. If the thread is idle, steal work from the head of deque associated with some other random thread.
  3. 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.
  4. 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.