MIS 6110 Assignment #1 (Spring 2015)

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 14

MIS 6010: IT INFRASTRUCTURE

ASSIGNMENT #1
Given on: 30th January 2015

Due: 14th February 2015

Lecturer: Dr. G. Chege (gchege@usiu.ac.ke;


Answer all Questions except Question 1which is for your own exercise.
Question #1 not for grading
A given application written in Java runs 15 seconds on a desktop processor. A new
Java compiler is released that requires only 0.6 as many instructions as the old compiler.
Unfortunately, it increases the cycles per instruction (CPI) by 1.1. How fast can we expect the
application to run using this new compiler? Pick the right answer from the three choices below:

Question #2 (6 marks)
For problems below, use the information about access time for every type of memory
in the following table.
Ca

che DRAM Flash Memory Magnetic Disk


a) Find how long it takes to read a file from a DRAM if it takes 2 microseconds from the
cache memory.
1microsecond = 1000 nanoseconds
Hence:
2*1000 = 2000 nanoseconds to be read
Number of times to be accessed

Cache a = 2000 / 5 = 400


Cache b = 2000 / 7 = 285.7142857
Now to multiply the times accessed by Magnetic Disks access time
Time a
400 * 5000 = 2000000 ns
20000 / 1000 = 2000 microseconds
Time b
285.71 * 70000 = 19999700 ns
19999700/ 1000 = 19999.7 microseconds

b) Find how long it takes to read a file from a disk if it takes 2 microseconds from the
cache memory.
Cache a = 2000 / 5 = 400
Cache b = 2000 / 7 = 285.7142857
Now to multiply the times accessed by DRAMs access time
Time a
400 * 50 = 20000 ns
20000 / 1000 = 20 microseconds
Time b
285.71 * 70 = 19999.7 ns
19999.7/ 1000 = 19.9997 microseconds
Approximately 20 microseconds

c) Find how long it takes to read a file from a flash memory if it takes 2 microseconds from
the cache memory.
Number of times to be accessed
Cache a = 2000 / 5 = 400
Cache b = 2000 / 7 = 285.7142857
Therefore
Time a = 400 * 5 = 2000 s
Time b = 285.71 * 15 = 4285.65 s

Question #3 (6 marks)
Consider three different processors P1, P2, and P3 executing the same instruction set with
the clock rates and CPIs given in the following table.

a) Which processor has the highest performance expressed in instructions per second?
Execution time = (instruction count * cycles per instruction) / clock rate
ic = instruction count
Processor p1 part a:
10 = ic * (5.5 * 10^ -10)
Number of instructions = 1.8 * 10^10

Cycles/1.8 * 10^10 = 2.2


3.96 * 10^10 cycles

Time = (ic *1.0) / (3* 10^9)


1 = ic * (5.0 * 10^-10)
ic = 2 * 10^9

Processor p2 part a:
Time = (ic *1.5) / (2.5* 10^9)
1 = ic * (4.0 * 10^-10)
ic = 2.5 * 10^9

Processor p3 part a:
Time = (ic *2.2) / (4.0* 10^9)
1 = ic * (5.5 * 10^-10)
ic = 1.8 * 10^9

Processor p1 part b:
Time = (ic *1.2) / (2.0* 10^9)
1 = ic * (6.0 * 10^-10)
ic = 1.67 * 10^9

Processor p2 part b:
Time = (ic *= 0.8) / (3.0* 10^9)
1 = ic * (2.67 * 10^-10)
ic = 3.75 * 10^9

Processor p3 part b:
Time = (ic *= 2.0) / (4.0* 10^9)
1 = ic * (5.0 * 10^-10)
ic = 2.0 * 10^9
Processor P2 has the highest performance as it has more instructions per second.

b) If the processors each execute a program in 10 seconds, find the number of cycles and
the number of instructions.
From question a above we can use the value 10 instead of 1 to equate to
(Instruction count * cycles per instruction) / clock rate

Processor p1 part a:
10 = ic * (5.0 * 10^ -10)
Number of instructions = 2.0 * 10^10
CPI = cycles / instructions
= cycles / (2.0 * 10^10) = 1.5
=3.0 * 10^10 cycles
Processor p2 part a:
10 = ic * (4.0 * 10^ -10)
Number of instructions = 2.5 * 10^10
Cycles/2.5 * 10^10 = 1
2.5 * 10^10 cycles
Processor p3 part a:
10 = ic * (5.5 * 10^ -10)
Number of instructions = 1.8 * 10^10
Cycles/1.8 * 10^10 = 2.2
3.96 * 10^10 cycles
Processor p1 part b:
10 = ic * (6.0 * 10^ -10)
Number of instructions = 1.67 * 10^10
Cycles/1.67 * 10^10 = 1.2
2.004 * 10^10 cycles
Processor p2 part b:
10 = ic * (2.67 * 10^ -10)
Number of instructions = 3.75 * 10^10
Cycles/3.75 * 10^10 = 0.8
3.0 * 10^10 cycles
Processor p3 part b:
10 = ic * (5.0 * 10^ -10)
Number of instructions = 2.0 * 10^10
Cycles/2.0 * 10^10 = 2.0
4.0 * 10^10 cycles

c) We are trying to reduce the time by 30% but this leads to an increase of 20% in the CPI.
What clock rate should we have to get this time reduction?
To reduce time using the 10 seconds used in question b above:
10 (10 * 0.3) = 7
Percentage increase in CPI = (100 + 20)%
=120%
=1.2 increase in CPI
Processor p1 part a:

7 = (2 * 10^10 * 1.2 * 1.5) / Clock


= 5.14 GHz

Processor p2 part a:
7 = (2.5 * 10^10 * 1.2 * 1.0) / Clock
= 5.29 GHz

Processor p3 part a:
7 = (1.8 * 10^10 * 1.2 * 2.2) / Clock
= 6.79 GHz

Processor p1 part b:
7 = (1.67 * 10^10 * 1.2 * 1.2) / Clock
= 3.44 GHz

Processor p2 part b:
7 = (3.75 * 10^10 * 1.2 * 0.8) / Clock
= 5.14 GHz

Processor p3 part b:
7 = (2.0 * 10^10 * 1.2 * 2.0) / Clock
= 6.86 GHz

Question #4 (6 marks)
Consider two different implementations of the same instruction set architecture.
There are four classes of instructions, A, B, C, and D. The clock rate and CPI of each
implementation are given in the following table.

a) Given a program with 106 instructions divided into classes as follows: 10% class A, 20%
class B, 50% class C, and 20% class D, which implementation is faster?
Class A:
106 * .1 = 10.6 = 11
Class B:
106 * .2 = 21.2 = 21
Class C:
106 * .5 = 53 = 53
Class D:
106 * .2 = 21.2 = 21

Time = ((Ia * CPIa) + (Ib * CPIb) + (Ic * CPIc) + (Id * CPId)) / Clock
p1 part a:
((11 * 1) + (21 * 2) + (53 * 3) + (21 * 3)) / (2.5*10^9)
= 1.1 * 10^-7
p2 part a:
((11 * 2) + (21 * 2) + (53 * 2) + (21 * 2)) / (3*10^9)
= 7.067 * 10^-8
p1 part b:

((11 * 2) + (21 * 1.5) + (53 * 2) + (21 * 1)) / (2.5*10^9)


= 7.22*10^-8
p2 part b:
((11 * 1) + (21 * 2) + (53 * 1) + (21 * 1)) / (3*10^9)
= 4.23 * 10^-8

b) What is the global CPI for each implementation?


CPI = (Time * Clock) / Instruction
P1 part a:
((1.1*10^-7) * (2.5*10^9))/106
= 2.59433962264
P2 part a:
((7.067 * 10^-8) * (3*10^9))/106
= 2.00009433962
P1 part b:
((7.22*10^-8) * (2.5*10^9))/106
= 1.70283018868
P2 part b:
((4.23 * 10^-8) * (3*10^9))/106

= 1.19716981132

c) Find the clock cycles required in both cases.


T = (Instruction * (Cycle/Instruction)) / Clock
T * Clock = Instruction (Cycle/Instruction)
(T*Clock) / Instruction = Cycle/Instruction
T*Clock = Cycle
P1 part a:
(1.1 * 10^-7)*(2.5*10^9)
= 275
P2 part a:
(7.067 * 10^-8)*(3*10^9)
= 212.01
P1 part b:
(7.22*10^-8)*(2.5*10^9)
= 180.5
P2 part b:
(4.23 * 10^-8)*(3*10^9)
= 126.9

Question #5 (6 marks)
Consider two different implementations, P1 and P2, of the same instruction set. There are
five classes of instructions (A, B, C, D, and E) in the instruction set. The clock rate and CPI
of each class is given below.

Clo

ate CPI Class A CPI Class B CPI Class C CPI Class D CPI Class E
a) Assume that peak performance is defined as the fastest rate that a computer can execute
any instruction sequence. What are the peak performances of P1 and P2 expressed in
instructions per second?
Execution time = (instruction time * cycles per instruction) / clock frequency
T = 1second
Fastest execution rate = Lowest CPI Class

P1 part a:
1 = (I * 1)/(2.0 * 10^9)
1 * (2.0 * 10^9) = (I * 1)
(1 * (2.0 * 10^9))/1 = I
=2.0 * 10^9 instructions per second
P2 part a:
1 = (I * 1)/(4.0 * 10^9)
1 * (4.0 * 10^9) = (I * 1)
(1 * (4.0 * 10^9)) / 2 = I
=2.0 * 10^9 instructions per second

P1 part b:
1 = (I * 1)/(2.0 * 10^9)

1 * (2.0 * 10^9) = (I * 1)
(1 * (2.0 * 10^9))/1 = I
=2.0 * 10^9 instructions per second
P2 part b:
1 = (I * 1)/(3.0 * 10^9)
1 * (3.0 * 10^9) = (I * 1)
(1 * (3.0 * 10^9))/1 = I
=3.0 * 10^9 instructions per second

b) If the number of instructions executed in a certain program is divided equally among the
classes of instructions except for class A, which occurs twice as often as each of the others,
which computer is faster? How much faster is it?
2 Instructions for Class A, 1instruction for the rest
T = (2 * 1 + 2 + 3 + 4 + 3) / (2.0 * 10^9)
= 7.0 * 10^-9
T = (2 * 2 + 2 + 2 + 4 + 4) / (4.0 * 10^9)
=4.0 * 10^-9
P = ( 4*10^-9) / (2.0 * 10^-9) = 2.0 times faster

T = (2 * 1 + 1 + 2 + 3 + 2) / (2.0 * 10^9)
=5.0 * 10^-9
T = (2 * 1 + 2 + 3 + 4 + 3) / (3.0 * 10^9)
=4.67*10^-9
P = ( 5.0 * 10^-9) / (4.67*10^-9) = 1.07 times faster

c) If the number of instructions executed in a certain program is divided equally among the
classes of instructions except for class E, which occurs twice as often as each of the others,
which computer is faster? How much faster is it?
2 Instructions for Class E, 1instruction for the rest
T = (2 * 3 + 2 + 3 + 4 + 1) / (2.0 * 10^9)
= 8.0 * 10^-9
T = (2 * 4 + 2 + 2 + 4 + 2) / (4.0 * 10^9)
=4.5 * 10^-9
P = ( 8.0 * 10^-9) / (4.5 * 10^-9) = 1.78 times faster

T = (2 * 2 + 1 + 2 + 3 + 1) / (2.0 * 10^9)
=5.5 * 10^-9
T = (2 * 3 + 2 + 3 + 4 + 1) / (3.0 * 10^9)
=5.33 * 10^-9
P = ( 5.5 * 10^-9) / (5.33 * 10^-9) = 1.04 times faster

Question #6 (6 marks)
The table below shows instruction-type breakdown for different programs. Using this data,
you will be exploring the performance trade-offs for different changes made to an MIPS
processor.

a) Assuming that computes take 1 cycle, loads and store instructions take 10 cycles, and
branches take 3 cycles, find the execution time on a 3 GHz MIPS processor.
Program 1:
Execution time of A = ((600*1) + (200 *10) + (600*10) + (50*3)) / (3*10^9)
=600 + 2000 + 6000 + 150) / (3*10^9)
Execution time = 2.92 * 10^-6
Program 2:
Execution time of A = ((900*1) + (100 *10) + (500*10) + (200*3)) / (3*10^9)
=900 + 1000 + 5000 + 600) / (3*10^9)
Execution time = 0.0000025

b) Assuming that computes take 1 cycle, loads and store instructions take 2 cycles, and
branches take 3 cycles, find the execution time on a 3 GHz MIPS processor.
Program 1:
Execution time of A = ((600*1) + (200 *2) + (600*2) + (50*3)) / (3*10^9)
=600 + 400 + 1200 + 150) / (3*10^9)
Execution time = 7.83 * 10^-7
Program 2:
Execution time of A = ((900*1) + (100 *2) + (500*2) + (200*3)) / (3*10^9)
=900 + 200 + 1000 + 600) / (3*10^9)
Execution time = 0.0000009
c) Assuming that computes take 1 cycle, loads and store instructions take 2 cycles, and
branches take 3 cycles, what is the speedup if the number of compute instruction can be
reduced by one-half?

Program 1:
Execution time of A = ((600*1) + (200 *2) + (300*2) + (50*3)) / (3*10^9)
=600 + 400 + 600 + 150) / (3*10^9)
Execution time = 5.83 * 10^-7

Program 2:
Execution time of A = ((900*1) + (100 *2) + (250*2) + (200*3)) / (3*10^9)
=900 + 200 + 500 + 600) / (3*10^9)
Execution time = 7.33 * 10^-7

You might also like