Deep dive into the Go scheduler, or Why would I steal goroutines?
summary
A technical deep-dive into Go’s scheduler explaining why and how goroutine stealing (work stealing) works inside the Go runtime. Covers Go runtime internals and scheduler algorithms, showing problems that steal/transfer goroutines between processors (P) to balance load and improve throughput.
AI-written summary · about
chapters (21)
- 0:00Introduction
- 1:34Stealing routines
- 3:20Why steal routines
- 6:10Go scheduler types
- 7:13GMP model
- 11:54Goroutine creation
- 15:30Memory reuse in goroutines
- 20:30Global vs local queues
- 25:30Finding goroutines
- 27:17Stealing from other P
- 30:26Current goroutine via assembly
- 31:51Parking/unparking goroutines
- 33:39Implementing stealing
- 35:05Summary
- 36:32Practical use and risks
- 37:58Q&A: GC concerns
- 39:37Q&A: Stealing efficiency
- 41:04Q&A: Thread stealing logic
- 43:38Q&A: Channel sync
- 44:43Q&A: Production use cases
- 47:14Q&A: CPU control








