Consider two different implementations of the same instruction set architecture. the instructions can be divided into four class
es according to their cpi (classes a, b, c, and d). p1 with a clock rate of 2.5 ghz and cpis of 1, 2, 3, and 3, and p2 with a clock rate of 3 ghz and cpis of 2, 2, 2, and 2. given a program with a dynamic instruction count of 1.0e6 instructions divided into classes as follows: 10% class a, 20% class b, 50% class c, and 20% class d, which is faster: p1 or p2?
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.
<span>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.</span>
The probability it will rain of Hari Merdeka is 2/15. Since you are finding the probability that will be no rain on Hari Merdeka, you also need to find the part of 15/15 that is not 2/15. You can do this by subtracting.
15/15-2/15=13/15.
The probability that will be no rain on Hari Merdeka is 13/15.