CIS 360: Homework 5

Due Thursday, March 8
no late homeworks accepted

Exercises:

  1. (25 points)
    Referring to Figure 12.4 on page 448 of the book, explain what happens when you hit the 'delete' key (or backspace key on some systems) to delete the last character typed in and erase it from the screen. In particular, explain the role of the various routines in the mechanism to delete the character (assuming UNIX-style echoing mechanism - see page 457, Figure 12.8a). the interrupt handler would detect the delete character and remove the last character that was put in the input buffer. The XOP and Application program would not be involved in the pocessing.
  2. (25 points)
    Assume the input buffer is initially empty. What happens with the following sequence of events: Specifically, when does the handler for each of the XOPs get executed relative to the user typing in characters? The first XOP handler waits until the return is hit. Then it, and the next two XOPs execute fetching 'A', 'B', 'C'. The fourth XOP never completes; it waits in the handler forever.
  3. (25 points)
    Why is DMA used with fast devices? Because the I/O device to too fast to be be generating interrupts for each character. The CPU wouldn't have a chance to get anything else done.
  4. (25 points)
    In your lab3, if you had to save 3 general purpose registers on the stack in the subroutine, how big does your stack have to be to handle a coefficient at level 10? Assume there are two sequential recursive calls in the subroutine. Assume that the recursive call happen for levels 2 and above - that is, the recursive subroutine does not do recursive calls when the 'level' parameter is one. Show your work. On the stack for each level of recursion is:
    • 2 parameters
    • return value
    • old FP
    • return address
    • 3 registers
    for a total of 8 words per call.

    For level one, there would be one call to the routine which would then immediately return. At level ten there would be ten recursive calls requiring 10*8 words. The two sequential calls would not make a difference.