Some Midterm Study Questions

22C:116, Fall 1999

Douglas W. Jones

Note that there is no intent that these questions cover the entire midterm! Please review other material, homework, etc!

  1. The problem: Between a user's call to read(f,buf,len) and the disk DMA hardware that eventually performs the desired action, many things must be done. What are they?

    You can get one list of answers if you focus on file to disk address translation.

    You can get a different list if you focus on virtual and physical memory addresses and the fact that DMA hardware is unlikely to know about virtual addresses.

    You can get another answer if you focus on the difference in I/O model between the stream oriented read() service and the sector oriented I/O primitives.

    This is a study question. All of the above are relevant and there is no correct answer!

  2. The problem: Consider the page fault trap service routine. If there are multiple processes, it would be natural to have the process that was blocked awaiting I/O required to handle a page fault use a wait() primitive to await completion of that I/O, thus allowing other processes to run.

    How would you implement the wait operation to allow a trap service routine to call it? What did you have to assume about the actual trap entry mechanism to make your implementation work?

    As an alternative to making wait() callable from within a trap service routine, the job of page-fault handling could be distributed between the actual page-fault trap service routine and various interrupt handlers, so that, at the very end, the disk interrupt handler would, on completing the I/O required to handle the page fault, fix the user's address map and signal the user saying it was done. What information must go with each disk request in the disk requeust queue to allow this? Write pseudocode for the page fault handler and disk handler to support this (of course, leave out all the details not specific to this!)