Go Surgery: a Goroutine and Its Innards
summary
Shows how goroutines are created by runtime.newproc, initial argument bytes checked against 2 KB minimum stack, passing large by-value structs can crash; scheduler uses the M/P/G model with work-stealing and goroutine pools for reuse; runtime exposes tracing via GODEBUG and stack dumps with runtime.Stack; a simple leak detector based on periodic runtime.Stack snapshots and parsing is implemented and used in net/http; explains goroutine states and how stacks grow and get copied.
AI-written summary · about
chapters (41)
- 0:00Intro
- 0:45Welcome
- 1:02About me
- 1:21Why is this talk important
- 2:48Questions
- 3:50Terminology
- 4:52What is a Goroutine
- 6:22Why go routines
- 8:08Native threading APIs
- 8:36Pthreads
- 9:10Conspiracy Theory
- 10:24Silk Plus
- 10:56Silk Program
- 11:24Pthread Program
- 11:43Create Thread
- 12:05Parallelized Fibonacci
- 12:31Runtime Gods
- 12:56Silk Look
- 13:20Synchronization Primitives
- 13:38States
- 14:44Idle State
- 15:19Copystack
- 16:02Quit
- 16:27Runnable
- 16:37Idle
- 17:23NewProc
- 17:47Argument Size
- 18:29Goroutine Crash
- 19:11Compiler Runtime
- 20:13Go Development
- 20:43Goroutines
- 22:34Device Register
- 22:57Crash
- 23:52Go Debug
- 24:30Environment Variables
- 24:56Screenshot
- 25:19Channel Send
- 25:34Utilities
- 25:58Freeze everything
- 26:23Goroutine leak detector
- 28:29Conclusion
related talks
35mGoroutines: the dark side of the runtime
22mTales of Go Runtime Scheduler
14mDr Gopher, Anatomy of the Scheduler
49mDeep dive into the Go scheduler, or Why would I steal goroutines?
16mIn the land of Gophers from age 3
26mGo Stack: Should It Be Moving Like That?
50mUnderstanding the Go runtime
40mDebugging concurrency programs in Go
