Homework 5

22C:116, Fall 1997

Due Friday Sept. 26, 1997, in class

Douglas W. Jones

  1. Modify the pseudocode given in Lecture 11 for a simple disk interrupt handler (in the section on disk request queues) so that it would work on a disk interface where the interface includes the RAM buffer to and from which disk I/O transfers are directed. Assume that this buffer is addressable at a fixed real address.

  2. The UNIX file system has, implicit in it, a class hierarchy. Consider the following "types" of files:

    a) Study these resources and construct an approximate class hierarchy for these UNIX resources. The root of this hierarchy is, of course, the abstract type file.

    b) Study these resources and construct an approximate implementation hierarchy for these UNIX resources. That is, which of these classes are implemented in terms of instances of others in the above list of classes.

  3. Here is the specification for a typical hardware real-time-clock:

    period
    a 16 bit register that can be automatically loaded into countdown.
    countdown
    a 16 bit counter that is decremented every 1.7 microseconds when in the run state. A real-time-clock interrupt will be requested whenever the counter is zero and the enable bit is one.
    control
    a control register with the following 1 bit fields:
    1. enable - when set, real-time-clock interrupts are enabled.
    2. run - when set, countdown will be periodically decremented.
    3. stop - when set, countdown equal zero will reset run.
    4. reload - when set, countdown equal zero will load countdown from period.
    Write pseudocode to implement the following real-time clock service in terms of this hardware:
    delay_signal(t,s)
    causes the semaphore s to be signalled after a delay of no fewer than t clock ticks, where a clock tick is 1.7 microseconds.