~/talk

Deep dive into the sync package

Talkat GopherCon UK 2025 · 2025-08-13..08-15· [concurrency, go]
slides:none on file

Shows how core sync types are implemented: WaitGroup stores an atomic state plus a semaphore and releases the semaphore once per waiter, Mutex stores bits for woken and starving plus a waiter count and switches fairness, Once uses an atomic bool fast path with a mutex slow path, sync.Map uses a read and dirty maps design with a miss counter that promotes dirty into read, sync.Pool keeps per-P local and victim pools so objects can survive one GC cycle, and Cond unlocks the mutex inside Wait.

AI-written summary · about

  1. 0:00Introduction
  2. 1:30Why sync matters in Go
  3. 2:13Atomic operations
  4. 5:14Semaphores for goroutines
  5. 7:39Understanding WaitGroup in depth
  6. 12:18Mutex internals
  7. 16:15How sync.Once ensures single execution
  8. 20:07sync.Map for concurrency
  9. 26:31sync.Pool for objects
  10. 31:52sync.Cond’s quirks
  11. 37:27Summary of sync primitives
  12. 38:31Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.