Go's work stealing scheduler
summary
Go’s scheduler distributes runnable goroutines onto a small pool of OS threads using work-stealing to avoid a global lock and spinning threads to reduce context switches. It introduces work stealing in version 1.1, gives each processor a local run queue, and checks the global queue 1/16 of the time. Spinning occurs in three concrete cases, and the execution tracer is the recommended tool to visualize underutilized cores and diagnose contention patterns.
AI-written summary · about
chapters (11)
- 0:00Start
- 1:19outline
- 1:45scheduling?
- 2:19go's runtime scheduler
- 2:50processors, threads goroutines
- 5:41challenges
- 6:38work sharing or stealing?
- 8:20work stealing
- 10:06spinning: goroutine to run
- 10:45spinning: processor assignment
- 10:58spinning: warm-up
related talks
49mDeep dive into the Go scheduler, or Why would I steal goroutines?
14mDr Gopher, Anatomy of the Scheduler
47mQueues, Fairness, and The Go Scheduler
22mTales of Go Runtime Scheduler
40mDebugging concurrency programs in Go
16mIn the land of Gophers from age 3
35mGoroutines: the dark side of the runtime
16mIn the Land of Gophers (from Age 3)
