The formula is : Tn = ( K + (N-1) ) * Tcp
where Tn = time taken by processor n
Tcp is time for execution ,
N = number of instructions to execute ,
K = number of pipeline stages
We have, Kp2 = 6 [ 3 ns]
Kp1 = 5 [ 3 ns, 4 ns, 3 ns, 2 ns, 4 ns ]
given N = 1000 , for processor P1, Tcp = max(execution time ) = 4 . For processor P2, Tcp = 3
Tp1 = ( 5 + ( 1000 - 1 ) ) * 4 = (5 + 999) * 4 = 4016
Tp2 = ( 6 + ( 1000 - 1 ) ) * 3 = ( 6 + 999) * 3 = 3015
time that can be saved by p2 over p1 for executing 1000 instructions is = 4016 - 3015 = 1001 ns