Homework 2

22C:116, Spring 2002

Due Monday Feb 4, 2002, in class

Douglas W. Jones

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! This should not need repeating, but every semester, someone forgets.

  1. Background: Consider a machine that can execute 1,000,000 instructions per second (pathetic, yes, but it is a round number that is easy to work with). Reading a device register into a CPU register, testing or setting a bit in a status register, incrementing an index register, storing from a register to ram, and doing a conditional or unconditional branch each take one instruction.

    To read one byte from the parallel port, you must first wait for the status to indicate data valid, then read the byte, then set the acknowledge bit, then wait for data-not-valid, then reset the acknowledge bit.

    Part A: Work out the algorithm used to read from the parallel port, to a sufficient level of detail that you can count the machine instructions.

    Part B: Estimate the peak data rate that could be sustained through this parallel port using your algorithm, in bytes per second. For this computer, any faster data rate will require use of DMA hardware.

    Part C: Would the use of interrupts allow a faster data rate? Explain.

  2. Problems from the Text: Do problems 8, 12 and 15 on page 68.

    Do problem 22 on page 69. This focuses on the specific mechanism used for system calls under UNIX, and forces you to think through something from Wednesday's lecture in more detail than was presented in class.