Why Pipeline a Microprocessor?

Modern CPUs all use pipelining to improve performance, but how does it work? We will use a warehouse robot analogy to explain how.

A factory robot moving packages around in an imaginary warehouse for processing. The moving corresponds to CPU instructions and packages can be thought of as data being processed.

Speeding Up CPUs By Increasing Clock Frequency

Warehouse robot is busy moving orange package towards the end of the line.

Benefits of Smaller CPUs

With shorter distances the moving task can be performed quicker.

Parallel Execution

Vector Processing

Moving multiple packages at the same time, corresponds to performing the same operation on multiple pieces of data at the same time. This what we call vector processing.

Multiple Microprocessor Cores

In a multi-core processor multiple instructions are performed in parallel. In principle each warehouse robot can work independently of the other.

Pipelining

Splitting the moving of a package into 3 separate steps. Each robot only carries a package 1/3rd of the way.

Clock cycle — 1

The two other warehouse robots have to initially remain idle while the “pipeline” gets filled up. The first robot moves the orange package 1/3rd of the way. This is 1st clock cycle.
First clock cycle has been completed. The second robot is not ready to pick up the orange package and move it 2/3rds of the final destination.

Clock cycle — 2

First and second warehouse robot can now move packages in parallel. But they must do this in lockstep to avoid collision. This is the 2nd clock cycle.
2nd clock cycle is finnished. The whole “pipeline” is now full. Next clock cycle all three robots are able to do work in parallel.

Clock cycle — 3

All three robots move a package in lockstep. The “pipeline” is full and this is when it works most effectively, as every clock cycle we are delivering a package at the end and picking up a new one.

Benefits and Challenges of Pipelining

RISC vs CISC Microprocessors

Taking Pipelining Too Far

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store