Respuesta :
Class A: 10^5 instr. Class B: 2 x 10^5 instr. Class C: 5 x 10^5 instr. Class D: 2 x 10^5 instr.
Time = no instr x CPI/ Clock rate
Total time P1 = (10^5 + 2 x 10^5 x 2 + 5 x 10^5 x 3 + 2 x 10^5 x 3) / (2.5 x 10^9) = 10.4 x 10^-4s
Total Time P2 = (10^5 x 2 + 2 x 10^5 x 2 + 5 x 10^5 x 2 + 2 x 10^5 x 2) / (3 x 10^9) = 6.66 x 10^-4s
CPI (P1) = 10.4 x 10^-4 x 3 x 10^9/10^6 = 2.6
CPI (P2) = 6.66 x 10^-4 x 3 x 10^9/10^6 = 2.0
Therefore, P2 is faster.
Time = no instr x CPI/ Clock rate
Total time P1 = (10^5 + 2 x 10^5 x 2 + 5 x 10^5 x 3 + 2 x 10^5 x 3) / (2.5 x 10^9) = 10.4 x 10^-4s
Total Time P2 = (10^5 x 2 + 2 x 10^5 x 2 + 5 x 10^5 x 2 + 2 x 10^5 x 2) / (3 x 10^9) = 6.66 x 10^-4s
CPI (P1) = 10.4 x 10^-4 x 3 x 10^9/10^6 = 2.6
CPI (P2) = 6.66 x 10^-4 x 3 x 10^9/10^6 = 2.0
Therefore, P2 is faster.
p2 is the faster processor.
Since we're executing 1 million instructions, let's first determine how many instructions of each class we execute. Just multiply 1 million by the percentage of each instruction class.
Class a = 0.10 * 1,000,000 = 100,000
Class b = 0.20 * 1,000,000 = 200,000
Class c = 0.50 * 1,000,000 = 500,000
Class d = 0.20 * 1,000,000 = 200,000
Now let's see how many clock cycles p1 takes to execute the program. This is the sum of the product of each instruction class and the clock cycles per instruction.
100,000 * 1 + 200,000 * 2 + 500,000 * 3 + 200,000 * 3
= 100,000 + 400,000 + 1,500,000 + 600,000
= 2,600,000
And the number of clock cycles for p2:
100,000 * 2 + 200,000 * 2 + 500,000 * 2 + 200,000 * 2
= 200,000 + 400,000 + 1,000,000 + 400,000
= 2,000,000
Finally, how long does each program actually take to execute? Just divide by the clock frequency.
p1:
2,600,000 / 2,500,000,000 = 0.00104 seconds
p2:
2,000,000 / 3,000,000,000 = 0.000666666666666667 seconds
And p2 is significantly faster than p1. In fact, p2 would still be faster than p1 even if the clock speeds were reversed with p1 being 3 GHz and p2 being 2.5 GHz. But with p2 having that higher clock speed, that's just icing on the cake.