Tricolor GC in Go: How the Marker Keeps Live Objects Alive — and What Happens Without the Write Barrier

Tricolor marking is not a garbage collection algorithm so much as a coexistence protocol between the collector and a program that keeps rewriting the object graph mid-traversal. I walk through the invariant, the write barrier (including Go’s hybrid barrier from 1.8), allocate-black and mark assist — and hand you an interactive sandbox where you can switch the barrier off and watch the GC free a live object.

September 12, 2026 · 8 min · 1611 words · Sebastian PE

Go Internals: sync.Mutex and sync/atomic — From Data Race to Starvation Mode

Mutex and atomic are not two independent tools — they are one stack of abstractions. I dig through the stack from data race to starvation mode: why x++ is three ARM64 instructions, how CAS became a universal primitive (Herlihy 1991), why Mutex is built on top of atomic CAS, and how Russ Cox’s barging-vs-handoff debate (issue #13086) gave Go its 1ms starvation threshold. With public benchmarks, the bit layout of Mutex state, and a cheatsheet for when to reach for which.

June 18, 2026 · 38 min · 7930 words · Sebastian PE