← Wed, Dec 2 digest

Getting to Go: The Journey of Go's Garbage Collector (2018)

read article ↗ hn thread ↗

Rick Hudson's 2018 keynote details Go's journey in redesigning its garbage collector to eliminate stop-the-world pauses, achieving sub-millisecond latency using a concurrent tri-color algorithm.

summary is enough While historically insightful regarding Go's runtime choices, readers familiar with Go's evolution can skim since newer GC developments have occurred since 2018.

summary

This 2018 ISMM keynote transcript by Rick Hudson explains how the Go team addressed the tyranny of the 9s to achieve predictable low-latency garbage collection. Facing strict constraints like supporting value-orientation, avoiding costly read barriers, and maintaining fast compilation times, the team implemented a non-moving, concurrent tri-color mark-sweep algorithm paired with a sophisticated GC pacer. Hudson also details failed experiments like the Request-Oriented Collector and a generational GC with sticky bits, providing rare insight into runtime trade-offs. The resulting architecture successfully dropped stop-the-world pauses from hundreds of milliseconds into the sub-millisecond range.

key points

  1. Go chose a non-moving, size-segregated span allocator to maintain fast interoperation with C via foreign function interfaces without complex pinning.
  2. The GC pacer uses a feedback loop to dynamically adjust mutator allocation speed and coordinate concurrent marking to finish just as memory runs out.
  3. Experimental approaches like a Request-Oriented Collector and a generational GC with sticky bits failed due to prohibitive write-barrier overhead on compiler performance.

who should read it

Systems programmers, runtime engineers, and Go developers interested in garbage collection internals.

discussion mixed

consensus

Commenters note that the article is from 2018 and point out subsequent advancements in Go's memory management, such as newer GC implementations.

best comment by pstuart ↗

There's been a fair amount of work since 2018 (the publish date of this article). A key one being the Green Tea GC -- https://go.dev/blog/greenteagc

Plenty of others as well, so it's not clear why this article now.

It highlights more recent garbage collector work that has occurred since this 2018 talk was published.

Generated by an LLM from the article and thread. Check the sources before relying on it.