Parallel &
Distributed Computing
Sequential vs. parallel vs. distributed, the speedup formula, four worked examples covering every case the exam tests, and why adding processors eventually stops helping.
§1 Why Parallel Computing Matters
A single processor can only do one thing at a time. For small tasks, that's fine. But when a program needs to process millions of data points, render a video, or train a machine learning model, a single processor would take hours, days, or longer.
The solution: split the work across multiple processors. If two processors each handle half the work, the job finishes roughly twice as fast. This is the core idea behind parallel and distributed computing — and the exam tests whether you understand when it helps, when it doesn't, and how to calculate the speedup.
The fundamental question for every parallel computing problem is: can the tasks run independently, or does one task depend on another's result? Independent tasks can be parallelized. Dependent tasks must wait — and that waiting is what limits speedup.
§2 Three Models
| Model | What it means |
|---|---|
| Sequential | Operations run one after another on a single processor. |
| Parallel | Multiple operations run simultaneously on multiple processors within one machine. |
| Distributed | Operations run across multiple separate computers connected by a network. |
§3 The Speedup Formula
Speedup = Sequential time / Parallel time
Parallel time = time for the parallelizable parts (divided across processors) + time for any parts that must still run sequentially.
Parallel computing only helps when tasks are independent. Tasks that depend on each other's results must still run in sequence, and that portion limits the maximum speedup.
§4 Four Worked Examples
Four independent tasks, each 20s. Two processors.
Sequential: 4 × 20 = 80s. Parallel: 2 tasks each → 2 × 20 = 40s.
Speedup = 80 / 40 = 2. Doubling processors doubles speed — the ideal case.
Tasks J (10s), K (30s), L (45s), M (90s). Two processors.
Sequential: 10 + 30 + 45 + 90 = 175s.
Best: M alone on one (90s), J+K+L on the other (85s). Parallel time = max(90, 85) = 90s.
Speedup = 175 / 90 ≈ 1.94. The slowest task becomes the bottleneck.
Steps 1 (10s), 2 (20s), 3 (30s), 4 (15s). Step 2 needs Step 1's output; Step 4 needs Step 3's.
Parallel on 2 processors: Steps 1→2 on one (30s), Steps 3→4 on the other (45s).
Parallel time = max(30, 45) = 45s. Speedup = 75 / 45 ≈ 1.67.
Dependencies form chains that can't be parallelized. The longest chain is the floor.
100s parallelizable + 20s sequential.
| Processors | Time | Speedup |
|---|---|---|
| 1 | 100 + 20 = 120s | 1 |
| 2 | 50 + 20 = 70s | ≈ 1.71 |
| 4 | 25 + 20 = 45s | ≈ 2.67 |
| 10 | 10 + 20 = 30s | 4 |
| 100 | 1 + 20 = 21s | ≈ 5.71 |
No matter how many processors you add, time can never drop below 20s. The sequential portion caps the speedup.
§5 Exam Patterns
5.1 "Assign tasks to minimize total time"
Parallel time can never be less than max(longest single task, total work / processors), but a split that exact is not always possible. Put the largest task on one processor, then give each remaining task (largest first) to whichever processor has the smaller total so far, and check the result.
5.2 "What is the speedup?"
Sequential time ÷ parallel time. Remember: parallel time = max of each processor's total, not the sum.
§6 Key Terms
| Term | Definition |
|---|---|
| Distributed computing | Computation split across multiple networked computers |
| Parallel computing | Multiple operations running simultaneously on multiple processors |
| Sequential computing | Operations run one after another on a single processor |
| Speedup | Sequential time divided by parallel time |
§7 Self-Check
- A program has 60s of parallelizable work and 10s of sequential work. What is the parallel time with 3 processors? With infinite?
- Tasks A (15s), B (25s), C (40s), D (20s) are independent. Assign to 2 processors to minimize time.
- Explain why adding more processors eventually stops producing meaningful speedup.
Show Answers
- 3 processors: 60/3 + 10 = 30s. Infinite: 0 + 10 = 10s (limited by sequential portion).
- C + A = 55s on one processor; B + D = 45s on the other. Parallel time = max(55, 45) = 55s. No split does better: the processor that runs C either runs it alone, leaving 60s for the other, or adds at least the shortest task, 40 + 15 = 55s. (C alone gives max(40, 60) = 60s.)
- Most programs have some sequential portion that can't be parallelized. Once the parallel work is small compared to the sequential part, adding processors gives diminishing returns — the sequential work sets a hard floor.