Pipelining in computer architecture is the processes of arranging the hardware so that simultaneous execution of multiple instructions takes place, thus, improving the overall performance. Pipelining is a fundamental concept in computer architecture that improves a processor's efficiency. It works by breaking down a complex instruction into smaller, more manageable steps. These steps are then executed in an assembly line fashion, like a factory pipeline.

Example of Pipelining in computer architecture
Let us consider a real-life example of taking food from a counter:
The entire process of taking food from the counter can be divided into various steps - Picking utensils, taking salad, taking food, taking vegetables, etc. Now consider the following two ways of executing this:
- One person enters and takes utensils, salad, food, vegetables, and leaves. Then another person enters and repeats the process.
- People stand in a queue such that when one person is taking vegetables, some other person will be taking food, someone will be taking salad and utensils.
You can see that the first process will have much lower efficiency than the second. While one person is taking food, the utensils, salad, and vegetable stalls are unused. On the other hand, people are simultaneously using the counter in the second process. Thus we have improved the efficiency of the process just by simultaneously executing multiple processes. Note that we have not used any extra resources.
The above example is similar to what we do in pipelining.
Types of Pipeline in Computer Architecture
The pipeline is divided into 2 categories:
- Arithmetic Pipeline
- Instruction Pipeline
1. Arithmetic Pipeline
An arithmetic pipeline focuses on dividing a single arithmetic operation (like addition, multiplication, etc.) into smaller stages. These stages could involve fetching operands from registers, performing the actual arithmetic calculation, and storing the result back in a register.
By pipelining arithmetic operations, the processor can potentially begin processing the next instruction while the current instruction is still completing in later stages. This improves the efficiency of the processor by keeping the arithmetic logic unit (ALU) constantly working on calculations.
2. Instruction Pipeline
An instruction pipeline breaks down the entire instruction fetch-decode-execute cycle into distinct stages. This might involve fetching the instruction from memory, decoding it to understand its operation, fetching operands, performing the operation, and storing the result.
With instruction pipelining, multiple instructions can be at different stages of execution concurrently, improving overall processor performance. This is because the processor is not stuck waiting for one instruction to complete all stages before it can begin processing the next one.
Stages of Pipelining
There are several stages of processing an instruction:
- Fetching the instruction - Reading instruction from memory.
- Decoding the instruction - Finding the type of instruction.
- Executing the instruction - Performing logical arithmetic operations according to the type of instruction.
- Memory Access - If the instruction requires read/write to the memory.
- Write Back - Storing the value back to the registers.
Without pipelining, one instruction will get processed at a time, but we can process multiple instructions simultaneously with pipelining. That means while one instruction is decoded, the next instruction will be fetched simultaneously, and so on.
However, this isn’t as simple as that. Some instructions may depend on other instructions. For example, instruction A updates a register, and instruction B uses the value stored in that register. So, we can’t directly decode instruction B until instruction A has completed written back. There are several ways to handle such scenarios like stalling, data forwarding, etc.
Also Read - Register in Computer and what is middleware




