Introduction
Hello! Welcome back to our study of parallel algorithm analysis.
In our last lesson, we focused on identifying the fundamental constraints to parallelization: data dependencies. We saw that true dependencies (Read-After-Write) create parts of a program that are inherently sequential, meaning their execution order cannot be changed. This sequential portion is the Achilles' heel of parallel performance.
Today, we'll answer the question we posed at the end of the last lesson: "If only part of my program can be parallel, how much faster can my whole program get?" This lesson directly addresses this by focusing on our learning outcome: to apply Amdahl's Law to calculate the theoretical speedup limit of a parallel algorithm. Amdahl's Law provides a simple but powerful mathematical model to quantify the performance gains you can expect from parallelization.
1. The Concept of Speedup and Its Ideal Limit
Before we dive into Amdahl's Law, let's formally define what we mean by "speedup."
Speedup, denoted as , is the ratio of the execution time of a program on a single processor to its execution time on parallel processors.
Where:
- is the execution time on one processor.
- is the execution time on processors.
In an ideal world, if you use processors, your program would run times faster, meaning . This is known as linear speedup. For example, with 8 processors, you'd hope for an 8x speedup. However, as our last lesson on data dependencies showed, some parts of the program are sequential and cannot be divided among processors. This serial fraction prevents us from achieving perfect linear speedup.
2. Deriving Amdahl's Law
Gene Amdahl formalized this relationship in 1967. His insight was to model the total execution time as a combination of two distinct parts: a fraction that is perfectly sequential and a fraction that is perfectly parallelizable.
To see how this works and how the famous formula is derived, let's watch a short video that explains it from first principles.
This video from Prof. Dr. Ben H. Juurlink provides a clear, visual derivation of Amdahl's Law. It starts by defining the serial and parallel fractions of a program and then logically builds the speedup equation based on how these fractions behave with multiple processors.
Please watch from the beginning up to 03:33. Focus on how the total execution time on one core (T_1) is broken down, and how the time on P cores (T_P) is formulated from those parts.
Let's quickly recap the derivation, solidifying the terms:
-
Let be the fraction of the program's execution time that is serial (cannot be parallelized).
-
Let (or in some texts) be the fraction that is parallelizable.
-
By definition, .
-
The total time on a single processor, , can be normalized to 1 unit of time. So, .
-
When running on processors:
- The serial part still takes time .
- The parallelizable part can, ideally, be sped up by a factor of , so it takes time .
-
The total time on processors is therefore .
-
The speedup, , becomes:
This final equation is Amdahl's Law.
3. The Dominance of the Serial Fraction
The most profound implication of Amdahl's Law becomes clear when we consider what happens as we add a very large number of processors. What is the limit of speedup as ?
As becomes very large, the term approaches zero.
This is the central message of Amdahl's Law: the theoretical maximum speedup is determined entirely by the serial fraction of the code.
- If 50% of your code is serial (), the maximum speedup you can ever achieve is , even with a million processors.
- If 10% of your code is serial (), the maximum speedup is .
- If only 1% of your code is serial (), the maximum speedup is .
The following graph visualizes this limitation powerfully.

Notice how quickly the speedup curves flatten out, especially for higher values of the serial fraction . Adding more processors yields diminishing returns, and the bottleneck created by the serial part comes to dominate performance.
4. Applying the Formula: Worked Examples
Let's put the formula to work with a couple of practical calculations. The following video walks through several examples of plugging numbers into the formula.
Amdahl's law and speedup in concurrent and parallel processing explained with example
This video provides several concrete examples of calculating speedup using Amdahl's Law with different percentages of parallelizable code and a fixed number of processors.
Please watch from 13:19 to 19:13. Observe how the parallel percentage (p) and the number of processors (n) are used in the formula to calculate the final speedup.
Now, it's your turn to apply the law.
Practice Problem:
Imagine you are working on a simulation program. A profiler tells you that 95% of the runtime is spent in a large, parallelizable loop, while the remaining 5% is for initial setup and final report generation (which are serial).
- What is the expected speedup on a modern 16-core workstation?
- Your company is considering buying a supercomputer with 1024 cores. What is the theoretical speedup you could get on that machine?
- What is the absolute maximum speedup you could ever hope to achieve for this program, regardless of the number of cores?
Take a moment to calculate the answers.
Solution:
Here, the serial fraction is , and the parallelizable fraction is .
-
On 16 cores ():
Even with 95% parallel code, you get just over 9x speedup on 16 cores, not 16x.
-
On 1024 cores ():
Notice the sharply diminishing returns. Increasing the core count by 64x (from 16 to 1024) only doubles the speedup.
-
Maximum Theoretical Speedup:
No matter how many processors you use, you can never make this program run more than 20 times faster than the original.
5. Assumptions and Limitations
Amdahl's Law is a powerful tool for developing intuition, but it's important to recognize its underlying assumption. It analyzes strong scaling, where the problem size is fixed. You are using more processors to solve the same problem, faster.
The law also makes simplifying assumptions, ignoring real-world complexities such as:
- Communication overhead: Processors need to coordinate, which takes time.
- Memory bandwidth limitations: All cores competing for access to RAM can create a new bottleneck.
- Load balancing issues: It might not be possible to divide the work perfectly evenly.
Despite these simplifications, Amdahl's Law provides an essential, if optimistic, upper bound on the performance you can expect.
Conclusion
In this lesson, we dissected one of the most fundamental principles of parallel computing. The insights you've gained are critical for setting realistic performance expectations and for identifying where to focus optimization efforts.
Key Takeaways:
- Amdahl's Law provides the theoretical speedup of a program based on its serial fraction () and the number of processors (): .
- The performance gain from parallelization is ultimately limited by the serial portion of the code.
- The absolute maximum speedup an application can achieve is , regardless of how many processors are used.
- Amdahl's Law describes strong scaling, where the goal is to solve a fixed-size problem faster.
Preview of the Next Lesson
Amdahl's Law can seem pessimistic. It suggests that adding more processors offers limited benefits. But what if, instead of solving the same problem faster, we used more processors to solve a bigger or more detailed problem in the same amount of time? This perspective, known as weak scaling, is described by Gustafson's Law, and it will be the subject of our next lesson.