This chapter explains what can go wrong when several activities share data or a processor, and which tools make that sharing safe. It begins with the difference between concurrency §9.1 and parallelism, then defines race conditions §9.2 and data races §9.3, critical sections §9.4, and the mechanisms that protect them: mutexes §9.5, semaphores §9.6, spinlocks §9.7, atomic operations §9.8 and compare-and-swap §9.9. Next comes the memory model that says which writes a thread can see, with the happens-before relation §9.10, acquire-release ordering §9.11 and sequential consistency §9.12, followed by the progress guarantees called lock-free §9.13 and wait-free.
The middle of the chapter covers the failures of locking and scheduling: deadlock §9.14 and lock ordering §9.15, priority inversion §9.16 and priority inheritance §9.17, starvation §9.18 and head-of-line blocking §9.19. It then shows how readers can keep using shared data while a writer replaces it: read-copy update §9.20 and its grace periods §9.21, reference counting §9.22, coherent snapshots §9.23 and immutable publication §9.24, together with the ABA problem §9.25, in which a value changes and changes back unnoticed, and the time-of-check to time-of-use §9.26 error. The last part is about time and flow: reentrant code, asynchronous completion §9.28 and cancellation §9.29, backpressure §9.30 and bounded queues §9.31, response time versus execution time §9.32, worst-case execution time §9.33, deadlines and timeouts §9.34, monotonic and wall clocks §9.36, schedulability §9.37, and rate limiting §9.38. The entries on the volatile qualifier §4.34 and on memory barriers §4.37 in the memory chapter are useful background.