Patterson & Hennessy. Chapter 2
The key to handling word problems relating to performance is to remember a few definitions (CPI, clock rate vs. clock cycle, execution time vs. performance) and the following equation, as seen in The Big Picture on p.63 of the text:
CPU execution time =
Instructions Program x
Clock cycles Instruction x
Seconds Clock cycle The following questions can be recast as applications of this formula. However, how to do the recasting can be subtle.
Drag the mouse over the space below to see the answer.
Remember that CPI is defined as the average number of clock cycles expended per instruction for a particular program execution. It is not a general measure. But looking back at our equation above, we see that the second term is CPI. Further, the first term of the equation is the same for both executions (on Machine A and on Machine B). We are asked which machine is faster, that is, which has the shorter execution time.
|
|
To determine how much slower Machine B is than Machine A, we divide the execution time of B by the execution time of A. Note that because both machines are running the same program, that the number of instructions in each execution is the same.
|
= |
|
= |
|
= | 1.4 | |||||||||||||||
So Machine A runs this program 1.4 times faster than Machine B.
Drag the mouse over the space below to see the answer.
|
|
But the question stated that the program runs in the same time on both machines. So, CPU timeB and CPU timeC are the same.
| InstructionsB | x | 2.8 ns | = | InstructionsC | x | 1.8 ns |
|
= |
|
= | 1.55... |
So Machine C executes 1.55 times more instructions than Machine B to execute the same program in the same time.
Drag the mouse over the space below to see the answer.
First, you can assume that the Instruction count and the CPI (for the program) rae the same on both machines. Second, note that the third term of the equation (seconds / clock cycle) is the inverse of clock rate. That leaves us with the following equations:
|
|
Merging the two equations, we get:
| 5 sec | x | Clock rateD | = | 4 sec | x | Clock rateE |
Thus,
| Clock rateE | = | 1.2 | x | Clock rateD |
That is, Machine E processor's clock rate is 1.2 times that of Machine D.