Go's memory model defines when one goroutine's writes are visible to another: channel operations, mutexes and sync/atomic create happens-before edges. Anything else is a data race, and races are undefined behaviour even if tests pass — run -race in CI.
← Go theorytheory 0/50 · 0%
Concurrency · hard
38. The Memory Model and Race Detection
Happens-before in practice.
Check your understanding
1. Which creates a happens-before edge?
2. A data race in Go is…