Compute the CPI for a computer that runs its workload composed of two programs. Program 1 runs 2,849,666 instructions using 11,850,490 clock cycles, while program 2 runs 1,138,554 instructions using 4,078,158 clock cycles. The first program runs 7 times for each time program 2 runs.
Expert Answer
Consider that the workload is composed of these 2 programs only.
For every time Program 2 runs, the Program 1 runs 7 times
Total number of instructions completes for single run of Program 2(Itotal)= number of instructions for Program 2(I2) + 7 * number of instructions of Program 1(I1)
Itotal = I2 + 7*I1 = 1138554 + 7 * 2849666 = 1138554 + 19947662 =21086216
Total number of clock cycles completes for single run of Program 2(CCtotal)= number of clock cycles for Program 2(CC2) + 7 * number of clock cycles of Program 1(CC1)
CCtotal = CC2 + 7*CC1 = 4078158 + 7*11850490 = 4078158 + 82953430 = 87031588
Cycles per Instruction or CPI = CCtotal/Itotal = 87031588/21086216 = 4.1274