Skip to main content

Pipeline and performance gain

Short answer

Pipelining divides instruction execution into k stages that process different tasks simultaneously. For n tasks, speedup S = n*k / (k + n - 1), approaching k for large n; example: k=4, tp=20ns, n=100 yields speedup 3.88.

What is pipeline? How is the performance of a computer increased using pipelining? Explain with example.

Pipeline

A pipeline is a technique in which a process is divided into stages (segments) that operate at the same time on different data, with the output of one segment feeding the next. It works like an assembly line, so several instructions are in different stages of execution at once.

How performance increases

For n tasks, k segments and clock time tp:

  • Without pipeline: T_np = n · k · tp
  • With pipeline: T_p = (k + n - 1) · tp
  • Speedup S = n·k / (k + n - 1). When n is large, S → k.
  • Throughput = n / ((k + n - 1) tp), which approaches one task per clock.

Example: 4 segments, tp = 20 ns, n = 100 instructions.

  • T_np = 100 × 4 × 20 = 8000 ns
  • T_p = (4 + 100 - 1) × 20 = 103 × 20 = 2060 ns
  • S = 8000 / 2060 = 3.88

So pipelining gives almost k times as much work per unit time without needing k separate processors, although hazards (data, control, structural) reduce the real gain.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Organization and Architecture chapter 4 questions →