04~solutions_for_chapter_4_exercises

04~solutions_for_chapter_4_exercises - Solutions for...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Solutions for Chapter 4 Exercises 1 Solutions for Chapter 4 Exercises 4.1 For P1, M2 is 4/3 (2 sec/1.5 sec) times as fast as M1. For P2, M1 is 2 times as fast (10 sec/5 sec) as M2. 4.2 We know the number of instructions and the total time to execute the pro- gram. The execution rate for each machine is simply the ratio of the two values. Thus, the instructions per second for P1 on M1 is (5 × 10 9 instructions/2 seconds) = 2.5 × 10 9 IPS, and the instructions for P1 on M2 is (6 × 10 9 instructions/1.5 sec- onds) = 4 × 10 9 IPS. 4.3 M2 runs 4/3 as fast as M1, but it costs 8/5 as much. As 8/5 is more than 4/3, M1 has the better value. 4.6 Running P1 1600 times on M1 and M2 requires 3200 and 2400 seconds re- spectively. This leaves 400 seconds left for M1 and 1200 seconds left for M2. In that time M1 can run (400 seconds/(5 seconds/iteration)) = 80 iterations of P2. M2 can run (1200 seconds/(10 seconds/iteration)) = 120 iterations. Thus M2 performs better on this workload. Looking at cost-effectiveness, we see it costs ($500/(80 iterations/hour)) = $6.25 per (iteration/hour) for M1, while it costs ($800/(120 iterations/hour)) = $6.67 per (iteration/hour) for M2. Thus M1 is most cost-effective. 4.7 a. Time = (Seconds/cycle) * (Cycles/instruction) * (Number of instructions) Therefore the expected CPU time is (1 second/5 × 10 9 cycles) * (0.8 cycles/instruction) * (7.5 × 10 9 instructions) = 1.2 seconds b. P received 1.2 seconds/3 seconds or 40% of the total CPU time. 4.8 The ideal instruction sequence for P1 is one composed entirely of instructions from class A (which have CPI of 1). So M1's peak performance is (4 × 10 9 cy- cles/second)/(1 cycle/instruction) = 4000 MIPS. Similarly, the ideal sequence for M2 contains only instructions from A, B, and C (which all have a CPI of 2). So M2's peak performance is (6 × 10 9 cycles/second)/ (2 cycles/instruction) = 3000 MIPS. 4.9 The average CPI of P1 is (1 × 2 + 2 + 3 + 4 + 3)/6 = 7/3. The average CPI of P2 is (2 × 2 + 2 + 2 + 4 + 4)/6 = 8/3. P2 then is ((6 × 10 9 cycles/second)/(8/3 cycles/instruction))/((4 × 10 9 cycles/second)/(7/3 cycles/instruction)) = 21/16 times faster than P1. 4.10 Using C1, the average CPI for I1 is (.4 * 2 + .4 * 3 + .2 * 5) = 3, and the average CPI for I2 is (.4 * 1 + .2 * 2 + .4 * 2) = 1.6. Thus, with C1, I1 is ((6 × 10 9 cycles/sec- ond)/(3 cycles/instruction))/((3 × 10 9 cycles/second)/(1.6 cycles/instruction)) = 16/15 times as fast as I2.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Solutions for Chapter 4 Exercises Using C2, the average CPI for I2 is (.4 * 2 + .2 * 3 + .4 * 5) = 3.4, and the average CPI for I2 is (.4 * 1 + .4 * 2 + .2 * 2) = 1.6. So with C2, I2 is faster than I1 by factor of ((3 × 10 9 cycles/second)/(1.6 cycles/instruction))/((6 × 10 9 cycles/second)/(3.4 cycles/instruction)) = 17/16. For the rest of the questions, it will be necessary to have the CPIs of I1 and I2 on programs compiled by C3. For I1, C3 produces programs with CPI (.6 * 2 + .15 * 3 + .25 * 5) = 2.9. I2 has CPI (.6 * 1 + .15 * 2 + .25 * 2) = 1.4. The best compiler for each machine is the one which produces programs with the lowest average CPI. Thus, if you purchased either I1 or I2, you would use C3.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/20/2010 for the course IE ie200 taught by Professor . during the Spring '10 term at 카이스트, 한국과학기술원.

Page1 / 7

04~solutions_for_chapter_4_exercises - Solutions for...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online