Concurrent Programming Primer, for CPython Developers¶
Note: this document was written with extensive LLM agent assistance.
This primer explains concurrent C programming and the mechanisms used by free-threaded CPython. Chapters 1–8 cover general concepts, chapters 9–13 cover CPython, and chapter 14 helps you choose a technique.
Start with shared mutable memory, or use the contents and topic index to find a specific subject. The glossary defines concurrency terms and links to relevant sections. For books, articles, talks, and reference material, see further reading.
Contents¶
- The basic problem: shared mutable memory
- The C abstract machine and undefined behavior
- The C memory model
- Atomic operations
- Synchronization
- Concurrency and performance
- Lock-free algorithms
- Safe memory reclamation
- CPython's concurrency model
PyMutex- CPython critical sections
- Stop-the-world
- QSBR in CPython
- Choosing a technique
The source for this site is on GitHub.