Problem Set 5

| categories: Problem Sets

Due: Wednesday 16 November before class.

Problem 1.

We wish to compare the performance of two different computers: M1 and M2. The following measurements have been made on these computers.


Time on M1

Time on M2


2.0 seconds

1.5 seconds


5.0 seconds

10.0 seconds

Which computer is faster for each program, and how many times as fast is it?

Problem 2.

Suppose that M1 in problem 1 costs $500 and M2 costs $800. If you needed to run program 1 a large number of times, which computer would you buy in large quantities? Why?

Problem 3.

Suppose you wish to run a program P with 7.5 billion instructions on a 5GHz machine with a CPI of 0.8. What is the expected CPU time? When you run P, it takes 3 seconds of wall clock time to complete. What is the percentage of CPU time P received?

Problem 4.

Consider two different implementations, I1 and I2, of the same instruction set. There are three classes of instructions (A, B, and C) in the instruction set. I1 has a clock rate of 6GHz, and I2 has a clock rate of 3GHz. The average number of cycles for each instruction class on I1 and I2 is given in the following table:


CPI on I1

CPI on I2

C1 Usage

C2 Usage

C3 Usage



















The table also contains a summary of average proportion of instruction classes generated by three different compilers. C1 is a compiler produced by the makers of I1, C2 is produced by the makers of I2, and the other compiler is a third-party product. Assume that each compiler uses the same number of instructions for a given program but that the instruction mix is as described in the table. Using C1 on both I1 and I2, how much faster can the makers of I1 claim I1 is compared to I2? Using C2, how much faster can the makers of I2 claim that I2 is compared to I1? If you purchase I1, which compiler would you use? If you purchased I2, which compiler would you use? Which computer and compiler would you purchase if all other criteria are identical including cost?

Problem 5.

Consider program P, which runs on a 1GHz machine M in 10 seconds. An optimization is made to P, replacing all instances of multiplying a value by 4 (mult X, X, 4) with two instructions that set x to x+x twice (add x,x,x; add x,x,x). Call this new optimized program P'. The CPI of a multiply instruction is 4, and the CPI of an add is 1. After recompiling, the program now runs in 9 seconds on machine M. How many multiplies were replaced by the new compiler?