Introduction
In the previous chapter, we covered different types of dependencies and coupling in C++. We looked at how common API design patterns and idioms can be implemented in C++ and what data structures are provided by Standard Libraries, as well as their efficacy. We also learned how to work with functional objects, lambdas, and captures. This knowledge will help us learn how to write clear and efficient multithreaded programs.
The heading of this chapter contains the name of the most significant synchronization issue in concurrent programming – The Philosopher's Dinner. In a few words, this definition is as follows.
Three philosophers are sitting at a round dining table with bowls of sushi. Chopsticks are placed between each adjacent philosopher. Only one philosopher at a time can eat their sushi with two chopsticks. Perhaps each philosopher will take one chopstick and then wait until someone gives up another chopstick. Philosophers are an analogy for three working processes...