Golang's Realtime GC in Theory and Practice
summary
Explains how Go turns classic mark-and-sweep into a concurrent collector using the tricolor algorithm with a write barrier and recoloring rules that guarantee any object becomes collectable within two cycles; demonstrates a simple buffer overwrite benchmark (sequentially overwriting N pointers) used to measure worst‑case pause. Sets a 50 ms SLA, observes Go typically <10 ms while Haskell’s stop‑the‑world runs show order‑of‑magnitude larger pauses; trace shows a ~15 ms mark pause caused by non‑yielding background mark workers that was later fixed.
AI-written summary · about
chapters (23)
- 0:00Intro
- 0:19Message Bus
- 2:44Why Garbage Collection
- 3:51Mark and Sweep
- 4:14Pseudocode
- 4:45Model Phase
- 7:42Garbage Collection
- 10:14Markandsweep
- 11:10Tricolore
- 12:58Examples
- 16:15Pointer Detection
- 17:17Garbage Detection
- 18:17Summary
- 21:37Benchmark Code
- 22:24Languages
- 23:03Results
- 23:27Haskell
- 25:49Visualizing the benchmark
- 28:11The blog post
- 28:25The issues
- 29:31The Go team
- 29:51Garbage collectors make tradeoffs
- 30:22Be clear about requirements
