Pipelining in processors

What does dual core, quad core and octa core processors mean would be explained in this tutorial using the concept of pipelining in processors

Refer previous tutorial for proper understanding. 

Pipelining:

This concept was introduced to increase the speed of the processor. It was implemented in 8086 and there was no pipelining until this generation processor. 

In non-pipelined processor:
There is a single unit which first fetches the instruction, decodes it and executes it. Once execution is completed for first instruction it fetches the second instruction and it goes so on. 
Intel engineers noticed that while execution the buses are free ( no work is done by buses while execution ) .

In pipelined processor:
Then the intel engineers come up with an idea, that there will be two units,  while one unit will be executing the instruction, and the second unit will fetch instruction. So that the first unit will not waste time to fetch instruction from the memory. Such multiple stages form a pipeline.
Another defination of pipelining

Triple pipelined:

In this pipelining type there are 3 stages, they do fetching, decoding and executing. Let’s assume there is a program of 6 instructions ( inst1, inst2…… inst6 ) that should be executed. 

Firstly, instruction 1 is fetched, decoded and while it is executing simultaneously 2nd instruction is decoded and third instruction is fetched. 

4 pipelined:

There are four stages of pipeline in this processor. Fetching, decoding , executing and storing. Storing the result becomes important nowadays. 
Pipelining in netburst pentium 4 processor has 4 cores , each pipeline has 20 stages, which means 80 instructions are fetched and executed. 

Dual core processor:

This processor consists of two pipelines, similarly quad core has 4 pipelines and octa core has 8 pipelines. Each pipeline can contain any number of stages depending on the architecture. In simple words dual core processors have individually two processors ( two pipelines ). Pentium processor has two pipelines ( each pipeline has 5 stages ) , this concept is known as super scalar pipeline. The concept of dual core and multiple pipeline is not exactly the same but is in the same form. 

Execution in super scalar pipelining:

Let us consider there are two pipelines of 8 stages each, but the pentium processor had 5 stages. They execute simultaneously, so the output order of instructions should not change. If 1-8 instructions enter in the first pipe, and 9-16 enter in the second pipe. Then execution order would be 1,9,2,10,3,11 and so on.

So the instructions should enter alternately. 

This was one of the things that could increase the speed of processors. Other things that can increase the speed of the processor.

  • Clock frequency
  • Bus size ( increasing number of data lines and address lines )

Drawbacks of pipelining:

Let us assume there is a pipeline which has 5 stages, which executes 5 instructions at a single moment. And let’s assume there is a program of 10 instructions that will be executed by this pipelined processor.

In the second instruction of the program there is a jump statement ( if , for , while…. Any kind of branch instruction ) that jumps from 2nd instruction to  9th instruction, that means after execution of 2nd instruction 9th instruction should be executed. 

While the first instruction is executed, the 5th instruction is already fetched, so when the second instruction is executed already 3,4,5 and 6 instructions are in queue. So it should discard those instructions and go to the 9th instruction. Problem arises when the pipeline has more units ( more than 20-30 units ), at that time it should discard 20-30 instructions when  a jump statement comes.

To solve this issue, there is an algorithm known as branch prediction algorithm, which almost solves 98-99% cases. 

Related topics

8086 architecture

Spread knowledge

1 thought on “Pipelining in Processors”

Leave a Comment

Your email address will not be published. Required fields are marked *