5. The Philosophers' Dinner – Threads and Concurrency
Learning Objectives
By the end of this chapter, you will be able to:
- Create synchronous and asynchronous multithreaded applications
- Apply synchronization to handle data hazards and race conditions
- Develop efficient multithreaded code with C++ thread library primitives
- Create threads using move semantics for multithreading closures
- Implement thread communication with futures, promises, and async
In this chapter, we will clarify the difference between basic terms in multithreaded programming, learn how to write multi-threaded code, find out which resources are provided by the C++ Standard Library for data access synchronization, learn how to prevent our code from encountering race conditions and deadlocks.