Assignment 7, due Mar. 6

Part of the homework for 22C:112, Spring 2009
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated (usually a Friday). The only exceptions to this rule will be by advance arrangement unless there is what insurance companies call "an act of God" - something outside your control. Homework must be turned in on paper and in class! Late work may be turned in to the teaching assistant's mailbox, but see the late work policy. Never push late work under someone's door!

  1. Background: Consider a file system where an open file is made to appear, largely, as a virtual disk drive.

    a) There's one particular operation you want on an open file that is not possible on a disk drive. Identify it. (0.5 points)

    b) Discuss the reasons you might want to open a raw disk as if it was an open file. (Note, in Unix, /dev/disk0/ is the raw boot disk and /dev/fd is the floppy disk, if you have just one.) (0.5 points)

  2. Background: Consider a disk scheduler running a naive implementation of the elevator algorithm, with one FIFO queue of disk I/O requests per cylinder of the disk. The interrupt handler operates as follows:
          if queue[current_cylinder].isempty() {
                current_cylinder = current_cylinder + 1 mod cylinders;
          } else {
                request = queue[current_cylinder].dequeue();
                start_IO_transfer( request );
                /* note:  disk ready bit is now zero until transfer done */
          }
          return_from_interrupt;
    

    a) There is a bug in this code. What happens if there are no disk I/O requests in any queues? (0.5 points)

    b) Fix the above bug (or at least, discuss how it can be fixed). (0.5 points)

    c) There is a bug in the above code. What happens to I/O requests from other processes if one process is always scheduling I/O in cylinder X, so the queue for cylinder X is never empty. (0.5 points)

    d) Fix the above bug (or at least, discuss how it can be fixed). (0.5 points)