Complete the following questions on CPU performance and show
Complete the following questions on CPU performance and show all of your work.
1. Suppose you wish to run a program P with 3 x 109 instructions on a 4.5 GHz machine with a CPI of 1.8. What is the expected CPU time?
2. Suppose you have the following instruction mix. What is the CPI?
Instruction Type Frequency Cycles
Memory 27 2
ALU 40 1
Branch 25 2
Jump 8 1
3. Consider two different processors P1 and P2 executing the same instruction set with the clock rates and CPIs given in the following table.
a. If the processors each execute a program in 15 seconds, find the number of cycles and the number of instructions for each processor.
b. We are trying to reduce the program execution time by 25%, but this leads to an increase of 20% in the CPI. What clock rate should we have to get this time reduction for each processor?
Processor Clock Rate CPI
P1 4 GHz 2
P2 4.5 GHz 1.5
You may find this table of clock cycle times and clock rates useful:
| Time Unit | Frequency Unit | |
| 1 | seconds | hertz | 
| 10-3 | millicseconds | kilohertz | 
| 10-6 | microseconds | megahertz | 
| 10-9 | nanoseconds | gighertz | 
| 10-12 | picoseconds | terahertz | 
Solution
1. CPU time= instruction count (IC)* clocks per instruction (CPI)* clock time (CT)
Here,
IC= 3*10^9
CPI=1.8
CT=1/4.5*10^9=0.22*10^-9
Expected CPU time=(3*10^9)*(1.8)*(0.22*10^-9)=1.188 s
2. CPI=Summation of (freq./100*cycles)
CPI=0.27*2+0.40*1+0.25*2+0.08*1=1.52
CPI=1.52
3. a. Number of cycles=CPU clock rate*execution time
P1=4*10^9*15=6*10^10
P2=4.5*10^9*15=6.75*10^10
Number of instructions=CPU clock rate*execution time/CPI
P1=4*10^9*15/2=3*10^10
P2=4.5*10^9*15/1.5=4.5*10^10
b. Execution time=(Number of instructions*CPI)/(clock rate)
We have to reduce the program execution time by 25% and increase 20% of CPI
Execution time*0.75=(Number of instructions*CPI*1.2)/(clock rate)
New clock rate=Old clock rate*1.2/0.75=old clock rate*1.6
New clock rate
P1=4*1.6*10^9=6.4*10^9
P2=4.5*1.6*10^9=7.2*10^9


