Multiprocess versus multithreaded

To help clearly understand why and how threads can provide a performance benefit, let's perform a few experiments! (the importance of being empirical - experimenting, trying things out - is a critical feature; our Chapter 19, Troubleshooting and Best Practices, covers more on such points). First, we take two simple example programs: one, a program that compares the creation and destruction of processes versus threads, and two, a program that performs matrix multiplication in two ways—one via the traditional single threaded process model, and two, via the multithreaded model.

So, what we are really comparing here is the performance in terms of execution time between using the multiprocess versus multithreaded ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.