Parallel & Distributed
Computing
Explore how modern systems split tasks across processors and networked machines to solve problems faster.
What Is Sequential Computing?
In a sequential computing model, a single processor executes one operation at a time. Each task must finish before the next one starts: the total time is the sum of all task times.
What Is Parallel Computing?
Parallel computing breaks a program into tasks that run simultaneously on multiple processors within the same machine. Independent tasks overlap in time, reducing total execution time.
What Is Distributed Computing?
Distributed computing spreads work across multiple networked computers. Each machine processes a portion of the task, and results are combined. This enables computation at a scale impossible for a single machine.
The Speedup Formula
Speedup measures how much faster a parallel solution is compared to a sequential one. It is the ratio of sequential time to parallel time:
Computing Parallel Time
When tasks run in parallel, the total time is determined by the longest-running task in each parallel group plus any sequential portions:
Parallel vs Distributed
| Parallel | Distributed | |
|---|---|---|
| Hardware | Multiple cores in one machine | Multiple networked machines |
| Communication | Shared memory (fast) | Network messages (slower) |
| Scale | Limited by core count | Virtually unlimited |
| Example | Multi-threaded video render | Google Search across data centers |
| Failure Impact | Entire process may crash | One node fails, others continue |
How to Solve Speedup Problems
Example 1: Two Processors
A program has four tasks: X (4 s), Y (6 s), Z (3 s), W (5 s). X and Y are independent. Z depends on X. W depends on Y. You have 2 processors.
Example 2: Three Parallel Tasks
A web server handles a request in 3 steps: Authenticate (2 s), then three independent database queries Q1 (4 s), Q2 (3 s), Q3 (6 s), then Render (1 s).
Example 3: Limits of Parallelism
A program has 5 tasks. Task A (10 s) must run first. Then B (4 s), C (6 s), D (3 s) can run in parallel. Finally E (2 s) runs last. You have 4 processors.
Amdahl's Law: The Speedup Ceiling
No matter how many processors you add, the sequential portion of your program limits the maximum speedup. If a fraction \( s \) of work must be sequential, the maximum speedup with \( n \) processors is:
Many machines still wait for the serial stage
Work that must happen sequentially limits the benefit of adding processors. Parallel time depends on dependencies and the busiest processor’s assigned work.The serial part sets a speedup ceiling
Suppose a 100-second workload contains 40 serial seconds and 60 perfectly divisible parallel seconds. Eight ideal processors take 40 + 60/8 = 47.5 seconds, a speedup of about 2.11. The limiting speedup is 100/40 = 2.5.Balance the processor loads
For independent tasks lasting 5, 3, 6 and 2 seconds on two processors, assign 5 + 3 to one and 6 + 2 to the other. Both finish at 8 seconds, reaching the 16/2 total-work lower bound.Benefits and Challenges
Real-World Applications
Common Mistakes
Summary Comparison
| Sequential | Parallel | Distributed | |
|---|---|---|---|
| Processors | 1 | Multiple cores | Multiple machines |
| Time Calc | \(\sum t_i\) | \(\sum t_{\text{seq}} + \max(t_{\text{par}})\) | \(\sum t_{\text{seq}} + \max(t_{\text{par}})\) + network |
| Speedup | Baseline (\(1\times\)) | \(> 1\times\) (limited by serial) | \(> 1\times\) (limited by network) |
| Best For | Simple, dependent tasks | CPU-heavy, splittable work | Massive-scale problems |
Question 1 of 5
Tasks P (3 s) and Q (5 s) run in parallel, followed by task R (4 s) running sequentially. What is the total parallel execution time?
Question 2 of 5
A program takes 20 seconds sequentially and 8 seconds with parallel processing. What is the speedup?
Question 3 of 5
Which best describes the difference between parallel and distributed computing?
Question 4 of 5
A program is 40% sequential and 60% parallelizable. With infinitely many processors, what is the maximum possible speedup?
Question 5 of 5
Tasks A (2 s), B (7 s), C (4 s), and D (1 s) all run in parallel on 4 processors. What is the total execution time for the parallel section?