In: Computer Science
Assume a non-pipelined processor takes 100 ns to process an instruction. The same instruction can be executed in a 5-stage pipelined processor, where each stage takes 20 ns.
(i) What is the minimum number of instructions for which the speedup achieved by the pipelined processor compared to the non-pipelined processor is at least 4?
(ii) The instruction takes the same time (100 ns) to execute whether on the pipelined processor or on the non-pipelined processor. So why do we say pipelining speeds up execution?
(i) The target speedup factor >=4.
Time taken for one instruction to be executed in non-pipeline system = 100 ns
Time taken for 'n' number of instructions to be executed in non-pipeline system = (100*n) ns
Time taken for one instruction to be executed in pipeline system = 100 ns
But every instruction after the first instruction will take 20 ns to execute. There will be no difference in execution time for both synchronous and asynchronous pipeline as each stage takes equal time.
Time taken for 'n' number of instructions to be executed in pipeline system = (100 + (n-1)*20) ns
According to the requirement ((100*n) / (100 + (n-1)*20)) >= 4
or, ((100*n) / (80 + 20n)) >= 4
or, 100n >= 320 + 80n
or, n >= 16
So, the number of minimum instructions = 16.
(ii) In the pipeline process there are five stages: fetch, decode, execute, memory and write back. In the non pipeline system every instruction takes the same amount of time. But in the pipeline system when the first instruction is in the decode state, the second instruction can be fetched in pipeline at the same time. Similarly, when the first instruction is in the execute state, the second instruction can be decoded and the third instruction can be fetched in pipeline at the same time. Due to this kind of operation pipeline system speeds up execution process.
Hope this helps.