retagged by
2,826 views
5 votes
5 votes
A pipeline processor has two branch delay slots. An optimizing compiler can fill one of these slots 85% of the time and can fill the second slot 20% of the time. What percentage improvement in performence achieved by this optimization, assuming 20% of the instruction executed are branch instruction?
retagged by

3 Answers

Best answer
7 votes
7 votes

Number of cycles needed to execute 100 instructions:

  1. For 100 instructions 20 instructions creates 2 stall cycle ( because they mention a pipeline processor has two branch delay slots.)  because of branch instruction.   

So total no of stall cycle/instruction = 0.80*0 + 0.20*2 = 0.40 Stall/instruction  

 Total time = 1 + 0.40 = 1.40 cycle/instruction .

now for 100 instructions total time takes 1.40 * 100 = 140 ( this is without optimization) 

so 140 is without optimization value, 

        2.  With optimization ( 140 - 20 * 0.85- 20 * 0.2 ) = 119

In question it is given "we assume that 20 percent of the instructions executed are branch instructions " 

here 20 is number of instructions out of 100 instructions

so 20* 0.85 as (optimizing compiler can fill one of these slots 85 percent of the time - is given in question)  and 20 * 0.2 ( as given - can fill the second slot only 20 percent of the time. )  and subtract that from 140, so it gives 119

 here {140 -( 20 * 0.85) - (20* 0.2) } = 119

now to calculate  percentage improvement in performance achieved by this optimization they use the formula

(without optimization time / with optimization time ) * 100 

that means {(140 / 119 )-1 * 100} = 17.64 %

Hence percentage improvement in performance achieved by this optimization is 17.64 %

3 votes
3 votes

For 100 instructions 20 instructions creates 1 stall cycle bcoz of branch instruction.
So total no of stall cycle/instruction = 0.80*0 + 0.20*1 = 0.20 Stall/instruction 
Total time = 1 + 0.2 = 1.20 Cycle /Instruction
-----------------------------------------------------------------------------------------------------
now after improvement with delayed slot "An optimizing compiler can fill one of these slots 85% of the time and can fill the second slot 20% of the time. "
    If 85%stall filled with useful instructions i.e. no stalls due to these 85% instructions,nd for rest of 15% ,20% out of those have 1 cycle stall nd 80% of those have 2 cycle stall 
hence tota  no of stall cycle/instruction= 0.80*0+0.20*0.85*0+0.20*0.15*0.20*1+0.20*0.15*0.80*2= .054
Total time = 1 + 0.054 = 1.054 Cycle /Instruction
% optimization =(1.2-1.054)*100/1.20=12.167%
-----------------arjun sir varify it.

edited by
Answer:

Related questions

0 votes
0 votes
1 answer
3