Processes versus threads

It is very important to decide properly when to use processes and when to use threads. One thing that we must be aware of is that a process must have a file loaded from a disk. We must understand that process is the complete entity which needs to be prepared and properly used. One more thing about a process is that its creation utilizes a lot of system resources, so you should use processes only when you need them.

On the other hand, threads are created much faster with less overhead, and loading from a disk does not occur. You only need to supply the StartAddress pointer, which is a user-defined routine (function). Do not forget that a process is still needed for stuff such as daemons, listeners (servers), and the like. ...

Get C++ Multithreading Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.