Multithreading versus multi-processing
After discussing multithreading and multi-processing in Chapter 14, Synchronization, together with concepts we have covered throughout the recent chapters, we are in a good position to compare them and give a high-level description of situations in which each of the approaches should be employed. Suppose that we are going to design a piece of software that aims to process a number of input requests concurrently. We discuss this in the context of three different situations. Let's start with the first one.
Multithreading
The first situation is when you can write a piece of software that has only one process, and all the requests go into the same process. All the logic should be written as part of the same process, and as a result, you get a fat process that does everything in your system. Since this is single-process software, if you want to handle many requests concurrently, you need to do it in a multithreaded way by creating threads...