(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
the XOP handler
the Application program
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.
(25 points)
Assume the input buffer is initially empty.
What happens with the following sequence of events:
the user types 'A'
the user types 'B'
the application program execution arrives at the first of 4 character input XOPs (e.g., 'ta 2')
the user types a 'C'
the user hits return
the user types a 'D' and drops dead
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.
(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.
(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.