Understanding the Go runtime
summary
Covers Go runtime v1.21 internals: the binary starts at an entry assembly that reads auxv then initializes TLS, CPU flags and the scheduler; the scheduler builds P/M/G structures and does a stop‑the‑world bootstrap that creates stack pools (2K/4K/8K/16K sizes) and the memory allocator. Explains spans and 8 KB page units so allocations round to spans (example next span 9,472 bytes), MHeap handling >32 KB, GC Pacer logic (GOGC=100 default), forceGC goroutine, sweeper/scavenger, the cismon timer (up to 10 ms), runtime.main and package init ordering.
AI-written summary · about
chapters (18)
- 0:00Introduction to Go runtime
- 1:29Compiler and runtime relationship
- 3:57Runtime overhead in Go binaries
- 8:14Bootstrap process of runtime
- 10:23Scheduler and its components
- 12:31Stop the world in garbage collection
- 13:38Memory allocator internals
- 21:37Garbage collector initialization
- 24:46Processor creation and start
- 26:09Sysmon and background processes
- 29:22Runtime before main function
- 31:53Resources and further learning
- 34:42Exploring Go runtime source code
- 36:09Q&A on runtime investigations
- 40:08Runtime thread management
- 44:44Channels and runtime complexity
- 46:29Motivation for studying runtime
- 47:33Init functions execution order
related talks
46mUnderstanding the Go runtime
30mMemory Management in Go: The good, the bad and the ugly
30mGo: escape analysis
38mUnderstanding Memory Allocation in Go
22mTales of Go Runtime Scheduler
26mGo Stack: Should It Be Moving Like That?
43mUnderstanding the Go Compiler
56mThe Key to Go Efficiency is Just a Few Go Runtime Metrics Away!
