Pardon the Interruption: Loop Preemption in Go 1.14
summary
Go 1.14 adds asynchronous preemption that uses signals (SIGURG) to stop goroutines anywhere and performs conservative innermost frame scanning to find pointers without full stack maps. It reduces preemption delay to ~25 microseconds, adds about 0.3% binary metadata, and has zero steady-state overhead. The implementation avoids per-loop checks, fixes tight-loop 47x throughput stalls and scheduler deadlocks, and works across architectures after kernel and debugger interactions are handled.
AI-written summary · about
chapters (6)
- 0:00Start
- 7:29Preempt back-edges, like other languages
- 9:08"Forward simulation" like some languages
- 11:11Use interrupts, like an OS kernel
- 13:22Signals + GC stack maps at every instruction
- 21:01Debug the Linux kernel?!
related talks
16mThe Benefits and Limitations of User Interrupts for Preemptive Userspace Scheduling
47mQueues, Fairness, and The Go Scheduler
14mGo's work stealing scheduler
35mGoroutines: the dark side of the runtime
40mDebugging concurrency programs in Go
10mGo I made all the mistakes
19mImplementing Parallelism
36mGolang's Realtime GC in Theory and Practice
