Chapter 5: Threads, Memory, and Concurrency
Until now, we have studied the performance of a single CPU executing one program, one instruction sequence. In the introduction of Chapter 1, Introduction to Performance and Concurrency, we mentioned that this is not the world we live in anymore, and we never touched the subject again. Instead, we studied every aspect of the performance of a single-threaded program running on one CPU. We have now learned all we need to know about the performance of one thread and are ready to study the performance of concurrent programs.
In this chapter, we're going to cover the following main topics:
- Overview of threads
- Multi-threaded and multi-core memory accesses
- Data races and memory access synchronization
- Locks and atomic operations
- Memory model
- Memory order and memory barriers