Vous êtes sur la page 1sur 6

Islamic University Gaza

Engineering Faculty
Department of Computer Engineering
ECOM 3010: Computer Architecture Discussion

Chapter 4
Exercises with solutions

Eng. Eman R. Habib

November, 2013
2 Computer Architecture Discussion

Exercise 1: (4.1 from book)

For P1:
Performance M2/Performance M1 = Execution time M1/ Execution time M2
= (2 sec/1.5 sec) = 4/3
M2 is 4/3 times as fast asM1.

For P2:
Performance M1/Performance M2 = Execution time M2/ Execution time M1
= (10 sec/5 sec) = 2
M1 is 2 times as fast asM2.

Exercise 2: (4.2 from book)

For P1 on M1:
The execution rate = number of instructions / time
= 5 109 instructions /2 seconds = 2.5 109 IPS

For P1 on M2:
The execution rate = number of instructions / time
= 6 109 instructions /1.5 seconds = 4 109 IPS
3 Computer Architecture Discussion

Exercise 3: (4.3 from book)

M2 runs 4/3 as fast as M1


But M2 costs 800/500 =8/5 as much.
As 8/5 is more than 4/3.
M1 has the better value.

Exercise 4: (4.6 from book)

Running P1 1600 times on M1 = 1600 2 = 3200 seconds


Running P1 1600 times on M2 =1600 1.5 = 2400 seconds
Running P2 on M1 = 3600 - 3200 = 400 seconds
Running P2 on M2 =3600 - 2400 = 1200 seconds
M1 can run (400 seconds / (5 seconds/iteration)) = 80 iterations of P2.
M2 can run (1200 seconds / (10 seconds/iteration)) = 120 iterations of P2.
Thus M2 performs better on this workload.
Cost-effectiveness:
For M1 it costs ($500 / (80 iterations/hour)) = $6.25 per (iteration/hour)
For M2 it costs ($800 / (120 iterations/hour)) = $6.67 per (iteration/hour)
Thus M1 is most cost-effective.

Exercise 5: (4.7 from book)

a. CPU Time = clock cycle time number of instructions CPI


= 1/(5 109) (Sec/cycle) (7.5 109 instructions) (0.8 cycles/instruction) = 1.2 sec
b. P received 1.2 seconds/3 seconds or 40% of the total CPU time.
4 Computer Architecture Discussion

Exercise 6: (4.8 from book)

The ideal instruction sequence for P1 is one composed entirely of instructions from class A
(which have CPI of 1).
So P1's peak performance is (4 109 cycles/second) / (1 cycle/instruction) = 4000 MIPS.
The ideal sequence for P2 contains only instructions from A, B, and C (which all have a CPI of 2).
So P2's peak performance is (6 109 cycles/second) / (2 cycles/instruction) = 3000 MIPS.

Exercise 7: (4.9 from book)

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.
Performance p2/Performance p1 = Execution time p1/ Execution time p2
= ((7/3 cycles/instruction) / (4 109 cycles/second))
/ ((8/3 cycles/instruction) / (6 109 cycles/second)) = 1.3125
P2 is 1.3125 times faster than P1.
5 Computer Architecture Discussion

Exercise 8: (4.14 from book)

The total execution time for the machines are as follows:


Computer A = 2 + 20 + 200 seconds = 222 seconds
Computer B = 5 + 20 + 50 seconds= 75 seconds
Computer C = 10 + 20 + 15 seconds = 45 seconds

Thus computer C is faster.


It is 75/45 = 5/3 times faster than computer B
And 222/45 = 74/15 times faster than computer A.

Exercise 9: (4.17 from book)

CPI = Execution time (second) clock rate (cycles/second) / number of instructions (Instructions)
CPI of P1 on M1 is
(2.0 seconds) (4 109 cycles/second) / (5 109 instructions) = 1.6 CPI
CPI of P1 on M2 is
(1.5 seconds) (6 109 cycles/second) / (6 109 instructions) = 1.5 CPI.
6 Computer Architecture Discussion

Exercise 10: (4.18 from book)

We have the CPI, the clock rate, and the total execution time, and we're trying to find the total
number of instructions. Using the following equation:
Instructions = Execution time (second) clock rate (cycles/second) / CPI (Cycles/instruction)
instructions in P2 on M1 is
(5.0 seconds) (4 109 cycles/second) / (1.6 Cycles/ instructions) = 12.5 109 instructions
instructions in P2 on M2 is
(10.0 seconds) (6 109 cycles/second) / (1.5 Cycles/ instructions) = 40 109 instructions

Best Wishes

Vous aimerez peut-être aussi