Skip to content
Opensource internals
  • Posts

Go

Go's sync.Mutex: Spin, Starve, and the Four-Millisecond Handoff

Oct 21, 2026 23 min read Jay Hubbert

sync.Mutex is an int32 state word and a semaphore: CAS fast path, four spin rounds, FIFO wait queue, and a starvation mode that hands ownership straight to the longest waiter.

GoInternalsConcurrencyMutex

Read more →

Go's Timers: A Per-P Heap and a Timer That Never Blocks a Thread

Oct 21, 2026 24 min read Jay Hubbert

Timers are heap entries owned by a P, checked by the scheduler at the top of every round; a sleeping goroutine parks on a timer attached to its own g, and no OS thread is ever …

GoInternalsTimersSchedulerConcurrency

Read more →

GODEBUG: The Knobs Go Gives You to Turn Up the Volume

Oct 21, 2026 19 min read Jay Hubbert

GODEBUG is two mechanisms wearing one name: a table of compatibility settings whose defaults change with each release, and a set of runtime debug knobs, both read from one …

GoInternalsGodebugRuntimeCompatibility

Read more →

GOMEMLIMIT and the Go Runtime's Memory Limit: Trading GC CPU for RAM

Oct 21, 2026 15 min read Jay Hubbert

GOMEMLIMIT is a soft ceiling on the runtime’s total memory; the runtime turns it into a heap goal that overrides the GOGC-derived goal, and scavenges more aggressively as it …

GoInternalsMemoryContainersGarbage collector

Read more →

How cgo Works in Go: The Two Compilers and a Bit of Magic

Oct 21, 2026 13 min read Jay Hubbert

cgo runs the C compiler to learn C types, rewrites your Go source into Cfunc wrappers, generates matching C glue that passes arguments in a struct, and each call goes through a …

GoInternalsCgoFfiRuntime

Read more →

← Newer Page 7 of 12 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·