O'Reilly logo

C++ Multithreading Cookbook by Milos Ljumovic

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required