Concurrency Patterns in Go
summary
Explains concrete concurrency rules and tradeoffs: CSP with channels and select handles about 90% of cases, showing fan-out/fan-in, closing semantics, and non‑blocking try-receive and timeout patterns. When channels fail, shows using mutexes for shared caches then stepping down to sync/atomic CAS spinning lock for tiny hot counters and a worked ticketed lock-free storage example that exposes ordering bugs and how to fix them with a done counter and careful atomic ops.
AI-written summary · about
chapters (22)
- 0:00Intro
- 1:23Concurrency in detail
- 2:23Communicating Sequential Processes (CSP)
- 4:15Go's concurrency toolset
- 6:44Blocking channels
- 8:16Blocking breaks concurrency
- 9:08Closing channels
- 11:38Select
- 12:15Making channels non-blocking
- 13:49Shape your data flow
- 14:17Fan-out
- 15:10Turnout
- 16:11Quit channel
- 17:16Where channels fail
- 18:40Mutexes are not an optimal solution
- 19:47Three shades of code
- 20:45Atomic operations
- 22:02Spinning CAS
- 24:36Ticket storage
- 26:50Debugging non-blocking code
- 28:30Guidelines for non-blocking code
- 30:06Concurrency in practice
related talks
26mConcurrency primitives of Golang - how to use and how not to
24mMastering Concurrency in Go: From Patterns to Production
44mConcurrency in Go: from hardware to code ☠️
27mProduction Ready Concurrency
54mComplex Concurrency Patterns with Go
46mOptimizing Concurrent Applications
27mA Channel Compendium
16mIn the land of Gophers from age 3
