Pipelining has nothing to do with uni- versus multi-processor systems. It has to do with thinking hard about the steps taken in executing a single instruction on a machine, in hardware.
Imagine you want to implement the MIPS "add-immediate" instruction, addi $d, $s, $t
, which adds an integer stored in the register named by $s
to an integer $t
directly encoded in the instruction, and stores the result in the register named by $t
. Think about the steps you'd need to take to do that. Here's one way of breaking it down (for example only, this doesn't necessarily correspond to real hardware):
- Parse out the (binary-encoded) instruction to find out which instruction it is.
- Once you recognize that it is an
addi
instruction, parse out the source and destination registers and the literal integer to add.
- Read the appropriate register, and compute the sum of its value and the immediate integer.
- Write the result into the named result register.
Now remember, all this needs to be built in hardware, meaning there are physical circuits associated with each of these things. And if you executed one instruction at a time, three fourths of these circuits would be sitting idle, doing nothing all the time. Pipelining takes advantage of this observation: If the processor needs to execute two addi
instructions in a row, then it can:
- Identify the first one
- Parse the first one, and identify the second one with circuits that would otherwise be idle
- Add the first one, and parse the second
- Write out the first one, and add the second
- Write out the second one
So now, even though each instruction takes 4 processing rounds, the processor has finished two instructions in just 5 rounds total.
This gets complicated due to the fact that sometimes you've got to wait for one instruction to finish before you know what to do in the next one (or even what the next one is), but that's the basic idea.