2.Concurrency
Go · 15 notes
- 2.1 Contexthistorical
Go context trees for cancellation, deadlines, timeouts, and request-scoped values, with lifecycle rules for passing and canceling contexts.
- 2.2 sync.WaitGrouphistorical
Waiting for a group of goroutines to finish with Add, Done, and Wait, including the counter lifecycle and common Add/Wait misuse.
- 2.3 The sync Packagehistorical
A map of Go's shared-memory synchronization primitives: Mutex, RWMutex, Once, Cond, Map, Pool, WaitGroup, and atomic operations.
- 2.4 sync.Maphistorical
Go's specialized concurrent map, its intended workloads, read-optimized internal design, atomic map operations, and when a normal map plus mutex is clearer.
- sync.Poolhistorical
Temporary object reuse, GC interaction, per-P optimization, and when pooling helps.
- 2.6 Selecthistorical
How Go `select` waits on multiple channel operations, chooses among ready cases, uses `default`, handles nil channels, timeouts, and cancellation.
- 2.8 sync.Mutexhistorical
Exclusive access to shared state with Go's Mutex, including zero-value usage, memory-ordering guarantees, critical-section design, and common mistakes.
- 2.9 sync.RWMutexhistorical
Go's reader/writer mutex: concurrent readers, exclusive writers, writer preference, non-upgradable locking, and when RWMutex is actually useful.
- 2.11 Atomic Operationshistorical
Go atomic operations, compare-and-swap, typed atomic values, atomic.Value, memory ordering, and when atomics are appropriate instead of locks.
- 2.12 Channelshistorical
Go channels as typed communication and synchronization primitives: buffered vs. unbuffered behavior, closing, ownership, blocking semantics, and runtime implementation.
- 2.13 Go Concurrencyhistorical
A map of Go concurrency: goroutines, channels, synchronization primitives, the memory model, happens-before relationships, and common concurrency patterns.
- 2.14 Goroutineshistorical
What goroutines are, how `go f(...)` starts concurrent execution, how their stacks differ from OS-thread stacks, and how the runtime schedules them.
- Goroutine Poolshistorical
Bounded concurrency, worker pools, queues, backpressure, and when a goroutine pool is unnecessary.