-
Book Overview & Buying
-
Table Of Contents
Software Architecture with C++ - Second Edition
By :
In this section, we’ll discuss a few ways to parallelize computations, where large tasks are broken into smaller independent sub-tasks and executed simultaneously on multiple processors or cores. Before we start, let’s say a few words on how to estimate the maximum possible gains you can have from parallelizing your code. There are three laws that can help us here.
The first is Amdahl’s law (see Figure 13.5). It states that if we want to speed up our program by throwing more cores at it, then the part of our code that must remain sequential (cannot be parallelized) will limit our scalability. For instance, if 90% of your code is parallelizable, then even with infinite cores, you can still get only up to a 10x speedup. Even if we cut down the time to execute that 90% to zero, the 10% of the code will always remain there.

Figure 13.5: Amdahl’s law demonstrating the theoretical maximum speedup
The Amdahl law formula...