Concurrency primitives are low-level synchronization mechanisms for coordinating concurrent executions that share memory. Common tools include mutexes, condition variables, and semaphores. section 1.5.2 section 9.1
Use classical primitives to:
- Restrict simultaneous access to shared memory and reduce race conditions with mutexes or semaphores. section 9.1
- Coordinate execution with condition variables, semaphores, waitgroups, and related synchronization tools. section 1.5.3
- Choose shared-memory synchronization when it fits the problem better or performs better than CSP-style message passing. section 1.5.2
The model offers precise control but exposes scheduling and memory-access complexity. Interleaved execution can create hard-to-reproduce races, verbose critical sections, unclear data flow, and difficult maintenance. section 8.2.1 section 9.1
CSP-style programming provides an alternative: isolated goroutines communicate through channels. Classical primitives remain useful when message passing is not the appropriate model. section 1.5.2
Compare the simplicity of message-passing designs with the performance and control available from shared-memory primitives. section 8.2.1

