Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

12. We wish to compare the performance of two different machines: M1 and M2. The

ID: 3666257 • Letter: 1

Question

12. We wish to compare the performance of two different machines: M1 and M2. The following measurements have been made on these machines Time on MI 10 secs 3 secs Progranm Time on M2 5 secs 4 secs Which machine is faster for each program and by what percent? 13. Consider the two machines and programs in Problem 12. The following additional measurements are made Pro Instructions executed on M1 Instructions executed on M2 200 10 160 10 Find the instruction execution rate (instructions per second) for each machine when running program 1 14. If the clock rates of machines M1 and M2 in Problem 12 are 200 MHz and 300 MHz respectively, find the clock cycles per instruction (i.e., CPI) for program 1 on both machines using data given in Problems 12 and 13 15. Assume that the CPI for program 2 on each machine is the same as the CPI for program 1 computed in Problem 14. Using these CPI values find the Instruction Count for program 2 running on each machine (use the execution times from Problem 12) 4 16. Suppose that machine M1 in Problem 12 costs $10,000 and M2 costs $15,000. If you ran program 1 on machines M1 and M2, clearly M2 executes the program faster (5 secs instead of 10 secs). However, you may not want to spend $5,000 extra on machine M2 to get a gain of 5 seconds for just a single run of program 1. But if you needed to run program 1 a large number of times and were concerned with the cost/performance ratio over thousands of runs instead of a single run, which machine would you buy in large quantities and why?

Explanation / Answer

12

For Program 1, M2 is faster since 1/5 > 1/10. Note that the ratio (1/5)/(1/10) = 2. Therefore, M2 is faster by 100%.

For Program 2, M1 is faster since 1/3 > 1/4. Note that the ratio (1/3)/(1/4) = 1.33. Therefore, M1 is faster by 33%.

13

For program 1:

Execution rate on M1 = 200 × 106 / 10 = 2 × 107 IPS (Instructions Per Second).

Execution rate on M2 = 160 x 106/ 5 = 3.2 x 10 7 IPS.

14

CPI = Execution time × Clock rate / Instruction Count

For program 1:

CPI on M1 = 10 × 200 × 106 / (200 × 106 ) = 10 cycles per instruction

CPI on M2 = 5 × 300 × 106 / (160 × 106 ) = 9.375 cycles per instruction

15

Instruction Count  = Execution time × Clock rate / CPI

Instruction Count on M1 : 3 x 200 x 106 / 10 = 60 x 106

Instruction Count on M2 : 4 x 300 x 106 / 9.375 = 128 x 106

16

M2 is twice as fast as M1, but it does not cost twice as much. M2 is clearly the machine to purchase.

Program Throughput on M1 Throughput on M2 1 1/10s 1/5s 2 1/3s 1/4s