Work Stealing: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
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]]
* [[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:
# 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.

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.