Exam 2 Review Answers

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Exam 2 Review

Exam overview:
20 questions
same reference sheets as Exam 1
yes: cheat sheet

Study:
functionality and roles of the compiler, linker, assembler, and loader
convert a simple real number to IEEE single-precision format (format
diagram given)
convert an IEEE single-precision hex representation to a real number
understand basic floating-point instructions as presented in examples in the
PowerPoint
computer performance questions (see below)
coding problems (supply missing line of code and/or describe what code
does)
break down MIPS instructions R, I, J type and explain the components

Computer Performance Review: Write these equations on your cheat sheet

Amdahls law:

Taf f ected
Timprov ed Tunaf f ected
improvemen t factor

1. (Amdahls law question) Suppose you have a machine which executes a program
consisting of 50% floating point multiply, 20% floating point divide, and the remaining
30% are from other instructions.
(a) Management wants the machine to run faster. You can make the divide run at most 3
times faster and the multiply run at most 8 times faster. If you could make only one
improvement, which one would you choose?

no change: 20 + 50 + 30 = 100 Can we get performance < 100%?

div: 20/3 + 50 + 30 = 86.67

mul: 20 + 50/8 + 30 = 56.25

(b) If you make both the multiply and divide improvements, what is the speed of the
improved machine? What is the speed relative to the original machine?

20/3 + 50/8 + 30 = 42.9

100/42.9 = 2.3 times faster

2. Computer A has an overall CPI of 1.3 and can be run at a clock rate of 600MHz.
Computer B has a CPI of 2.5 and can be run at a clock rate of 750 Mhz. We have a
particular program we wish to run. When compiled for computer A, this program
has exactly 100,000 instructions. When compiled for Computer B, the program has
60,000 instructions. Which computer will execute the program faster?

CPU time = I * CPI * cc time or I * CPI / clock rate

A = 100,000 * 1.3 / 600*10^6 = .00216

B = 60,000 * 2.5 / 750*10^6 = .0002 slightly faster

3. A benchmark was run on a CPU at 2.66 GHz. The program executed the 2.389E12
instructions in 750 s.
(a) What is the CPI?

CPU time = I * CPI / clock rate


750 = 2.3891E12 * CPI/2.66E9
750 * 2.66E9 / 2389.1E9 = CPI = .83

(b) Another CPU running at 1.8 GHz compiled the program into 1.2E12 instructions.
If its CPI is .9, will it run faster or slower that the computer in (a)?

CPU time = 1.2E12 * .9 / 1.8E9 = 1200 * .9 / 1.8 = 600 s so it is faster

4. For the following SPECratio table:

(a) Calculate the execution time is calculated for these two programs. Did you get
the same answer as the table? Why or why not?
perl = 2118E9 * 0.75 * 0.4E-9 = 635

bzip2 = 2389E9 * 0.85 * 0.4 = 812

(b) How is the SPEC ratio calculated?

reference time / execution time

You might also like