CS 354, version A
Spring 2007
Name:___________________
ID:___________________
Login:_____________________
Exam 3

No electronic devices may be used while taking this exam. Examples of devices not allowed are calculators, pagers, cell phones, wrist calculators/computers, laptop computers, pocket computers. Each student is allowed one 8.5 by 11 inch sheet of paper with handwritten notes. The notes may be on both sides of the paper.

Show all work, and do any/all calculations on the exam. Extra scratch paper may not be used.

Exam Score
EC = _____ /   4
Q1 = _____ /   8
Q2 = _____ / 16
Q3 = _____ /   5
Q4 = _____ /   8
Q5 = _____ /   6
Q6 = _____ / 17

Total = _____ / 60










Extra Credit Question (4 points)
Under what circumstance does the kernel we used for Assignment 6 enter a spin wait loop?







Question 1 (8 points)
Write a TAL assembly language synthesis for the MIPS assembly language instruction


     lw  $9, JumpTable($8)

Assume that label JumpTable has been assigned address 0x0040ab0c by the assembler.













Question 2 (16 points, 4 points for each part)
Use the following representation of MIPS machine code to answer this question.

address         contents
--------------------------

0x00400000      0x34010014



0x00400004      0x03a1e822



0x00400008      0x05200002



0x0040000c      0x00004020



0x00400010      0x2109ffff



0x00400014      0xafa80014



0x00400018      0x3402000a



0x0040001c      0x0000000c




PART A
One of the instructions is a branch instruction. Draw an arrow from the branch instruction to its branch target, to show where the instruction would branch to, if the branch were taken.


PART B
Identify all arithmetic and logical instructions by placing a plus sign (+) next to each one's machine code.


PART C
Circle the machine code for the syscall instruction.


PART D
One of these instructions is a load or store instruction. Identify which one by underlining its machine code, and give the MIPS assembly language equivalent for this instruction.







Question 3 (5 points total)
PART A (2 points)
Name an I/O device which is better handled by doing DMA transfers than by using polling and spin wait loops.



PART B (3 points)
Briefly, why are DMA transfers better than polling and spin wait loops for this device?







Question 4 (8 points total)
PART A (3 points)
Is the kernel we used for Assignment 6 intended to be reentrant or nonreentrant?

PART B (2 points)
While executing the code within a nonreentrant kernel, are interrupts sometimes enabled or
always disabled?

PART C (3 points)
Give a single MIPS assembly language instruction that will cause a trap.





Question 5 (6 points, 3 points for each part)
An assembly language application contains 1400 assembly language instructions. It is run to benchmark its execution time. It takes 14 seconds to run. The application's programmer then works on the assembly language code to make it better. After this, the application takes 10 seconds to run.

PART A
What is the speedup?





PART B
How many assembly language instructions were removed from this application to make this improvement? Briefly justify your answer.





Question 6 (17 points total)
PART A (4 points) Fill in the blanks:

Pipelining improves performance by increasing the _________________ of instruction completions.

It does not significantly change the ____________________ of each instruction's execution time.

PART B (2 points)
Name the two categories of dependencies.

1.                                2.
PART C (4 points)
In a single sentence answer, why do the designers of pipelined processors care about dependencies?






PART D (4 points)
Two applications are being executed to benchmark the performance of a computer system's cache. One application results in a hit ratio of .92, and the other application results in a hit ratio of .86. Are these statistics possible? Briefly justify your answer.






PART E (3 points)
A single cache is added to a computer system. This diagram illustrates the address as it is used by the cache. Identify on this diagram the number of bits used for each field.


         -------------------------------------------------
         |   tag    |   index #   |  byte within block   |
         -------------------------------------------------