ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Parallel & Distributed Computing
    COMP3139
    Progress0 / 33 topics
    Topics
    1. Introduction to Parallel and Distributed Systems2. Why Use Parallel and Distributed Systems?3. Speedup and Amdahl's Law4. Hardware Architectures: Multi Processors (Shared Memory)5. Hardware Architectures: Networks of Workstations (Distributed Memory)6. Hardware Architectures: Clusters (Latest Variation)7. Software Architectures: Threads and Shared Memory8. Software Architectures: Processes and Message Passing9. Software Architectures: Distributed Shared Memory (DSM)10. Software Architectures: Distributed Shared Data (DSD)11. Parallel Algorithms12. Concurrency and Synchronization13. Data and Work Partitioning14. Common Parallelization Strategies15. Granularity16. Load Balancing17. Examples of Parallel Algorithms: Parallel Search18. Examples of Parallel Algorithms: Parallel Sorting19. Shared-Memory Programming20. Threads in Shared-Memory Programming21. P Threads22. Locks and Semaphores23. Distributed-Memory Programming24. Message Passing25. Map Reduce26. Distributed-Memory Programming with PI27. Google's Map Reduce28. Hadoop29. Other Parallel Programming Systems30. Tread Marks31. Distributed Shared Memory32. Aurora: Scoped Behavior and Abstract Data Types33. S Enterprise: Process Templates
    COMP3139›Speedup and Amdahl's Law
    Parallel & Distributed ComputingTopic 3 of 33

    Speedup and Amdahl's Law

    8 minread
    1,328words
    Intermediatelevel

    Speedup and Amdahl's Law

    When you're dealing with parallel computing, one of the main goals is to improve the performance of your system. The most common way to measure this improvement is by calculating speedup, and Amdahl's Law is a mathematical model that helps us understand the theoretical limits of speedup when using parallel systems.

    Let’s dive into each concept:


    1. Speedup

    Speedup is a measure of how much faster a parallel system can solve a problem compared to a single processor or a non-parallel system. It’s defined as the ratio of the time it would take to complete a task using a single processor (serial time) to the time it takes using multiple processors (parallel time).

    Formula for Speedup:

    Speedup(S)=TserialTparallel\text{Speedup} (S) = \frac{T_{\text{serial}}}{T_{\text{parallel}}}Speedup(S)=Tparallel​Tserial​​

    Where:

    • TserialT_{\text{serial}}Tserial​ is the time it would take to complete the task on a single processor.
    • TparallelT_{\text{parallel}}Tparallel​ is the time it takes to complete the task when using multiple processors.

    Example:

    Imagine a task that takes 10 hours on a single processor. Now, if we use 4 processors and the task takes 3 hours, the speedup is:

    S=103=3.33S = \frac{10}{3} = 3.33S=310​=3.33

    So, the task is 3.33 times faster with 4 processors.


    2. Amdahl’s Law

    Amdahl's Law helps us understand the theoretical maximum speedup we can achieve from parallelizing a task. It is especially useful in understanding the limitations of parallelism — in other words, even though you add more processors, you may not get a proportional increase in speed due to parts of the task that cannot be parallelized.

    Formula for Amdahl’s Law:

    Smax=1(1−P)+PNS_{\text{max}} = \frac{1}{(1 - P) + \frac{P}{N}}Smax​=(1−P)+NP​1​

    Where:

    • SmaxS_{\text{max}}Smax​ is the maximum speedup.
    • PPP is the fraction of the program that can be parallelized.
    • NNN is the number of processors.
    • 1−P1 - P1−P is the fraction of the program that must remain serial (cannot be parallelized).

    Key Insights from Amdahl's Law:

    • If a large part of the task can’t be parallelized, then adding more processors won’t yield a huge improvement in performance.
    • The speedup will diminish as you add more processors, especially if the serial portion (non-parallelizable portion) of the task is significant.

    Example:

    Suppose a task consists of two parts:

    • 90% of the task can be parallelized (so, P=0.9P = 0.9P=0.9).
    • 10% of the task must remain serial (so, 1−P=0.11 - P = 0.11−P=0.1).

    Now, let’s see the speedup when using different numbers of processors:

    • Using 1 processor:

      Smax=1(1−0.9)+0.91=10.1+0.9=1S_{\text{max}} = \frac{1}{(1 - 0.9) + \frac{0.9}{1}} = \frac{1}{0.1 + 0.9} = 1Smax​=(1−0.9)+10.9​1​=0.1+0.91​=1

      The speedup is just 1 (no parallelism).

    • Using 4 processors:

      Smax=1(1−0.9)+0.94=10.1+0.225=2.86S_{\text{max}} = \frac{1}{(1 - 0.9) + \frac{0.9}{4}} = \frac{1}{0.1 + 0.225} = 2.86Smax​=(1−0.9)+40.9​1​=0.1+0.2251​=2.86

      With 4 processors, the speedup is 2.86.

    • Using 16 processors:

      Smax=1(1−0.9)+0.916=10.1+0.05625=7.14S_{\text{max}} = \frac{1}{(1 - 0.9) + \frac{0.9}{16}} = \frac{1}{0.1 + 0.05625} = 7.14Smax​=(1−0.9)+160.9​1​=0.1+0.056251​=7.14

      With 16 processors, the speedup is 7.14.

    What Amdahl’s Law Shows:

    As you can see from the example, even though you add more processors, the speedup doesn't grow linearly. The 10% of the task that must remain serial limits the maximum speedup. No matter how many processors you use, the speedup will be constrained by that serial portion.


    3. Practical Implications of Amdahl's Law

    Amdahl’s Law is crucial in understanding the limits of parallelism. Here are some important takeaways:

    • The serial part is the bottleneck: If a significant portion of your task cannot be parallelized, it will limit the benefits of adding more processors. For instance, if only 50% of your task can be parallelized, you won’t see much speedup, no matter how many processors you use.

    • Diminishing returns: As you add more processors, the increase in speedup decreases. After a certain point, adding more processors may not provide significant benefits. This is why parallel computing is most effective for problems where the parallelizable portion is large, and the serial portion is small.

    • Balance between parallel and serial work: The more work you can make parallel, the better your performance will be. But if most of the work is serial, then parallelizing may not give you much of an improvement.


    4. Example of Amdahl’s Law in Action

    Let’s consider a real-world example to see how Amdahl's Law works. Suppose you're working on a scientific simulation, and you find that 95% of the code can be parallelized, while 5% of it is inherently serial (perhaps due to dependency on previous calculations or I/O operations).

    • Parallelizable portion: 95% or P=0.95P = 0.95P=0.95
    • Serial portion: 5% or 1−P=0.051 - P = 0.051−P=0.05

    Let’s calculate the speedup using Amdahl's Law for different numbers of processors:

    • For 10 processors:

      Smax=1(1−0.95)+0.9510=10.05+0.095=6.67S_{\text{max}} = \frac{1}{(1 - 0.95) + \frac{0.95}{10}} = \frac{1}{0.05 + 0.095} = 6.67Smax​=(1−0.95)+100.95​1​=0.05+0.0951​=6.67
    • For 100 processors:

      Smax=1(1−0.95)+0.95100=10.05+0.0095=16.67S_{\text{max}} = \frac{1}{(1 - 0.95) + \frac{0.95}{100}} = \frac{1}{0.05 + 0.0095} = 16.67Smax​=(1−0.95)+1000.95​1​=0.05+0.00951​=16.67

    As you can see, even with 100 processors, the speedup is only 16.67x due to the 5% of the task that cannot be parallelized. This demonstrates the law of diminishing returns—adding more processors yields progressively smaller improvements when a large part of the task is serial.


    5. Other Considerations

    While Amdahl’s Law provides an important theoretical model, in real-world systems, other factors can also affect speedup:

    • Overhead: There’s often overhead involved in parallel computing (e.g., communication between processors, synchronization, and dividing the task). This overhead can reduce the theoretical speedup.
    • Distributed systems: For large-scale systems, Amdahl’s Law may not fully capture the complexity of distributed systems where tasks might involve more latency or communication across nodes.

    Conclusion

    • Speedup tells us how much faster a task can be done in parallel compared to using a single processor.
    • Amdahl’s Law shows that the maximum achievable speedup is limited by the serial portion of the task. Even with infinite processors, the speedup will be limited if a significant part of the task can’t be parallelized.

    By using Amdahl’s Law, you can assess whether it's worth investing in more processors for a given task, and how much improvement you can expect from parallelizing your code.

    Previous topic 2
    Why Use Parallel and Distributed Systems?
    Next topic 4
    Hardware Architectures: Multi Processors (Shared Memory)

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time8 min
      Word count1,328
      Code examples0
      DifficultyIntermediate