Homework 4

22C:116, Fall 1999

Due Friday Sept 17, 1999, in class

Douglas W. Jones
Several of the problems in this assignment refer to the thread manager given in http://homepage.cs.uiowa.edu/~dwjones/opsys/threads/ Please ignore the code for thread_manager_init() and thread_laungh(). This is some of the hardest code I've ever written! If you must read it, do all your homework first, then go back and read it!

  1. Background The UNIX setitimer() system call can be used to request a periodic SIGALRM signal to be delivered to the calling process. A handler for the signal on an HPUX system can installed with the sigvector() function. In many ways, the response of a process to a signal is very similar to the response of a CPU to an interrupt. This suggests that the example thread manager could be made preemptive by replicating much of the logic of relinquish() in the handler for SIGALRM.

    The Problem: Keeping in mind that we are using longjmp() and setjmp() for context switching, what feature of sigvector() prevents us from using this idea.

    Hint: The semantic issues involved are clearly presented in the first few paragraphs of the man page for sigvector().

  2. Outline the structure of a page fault handler for the R2000 (see Figure 3-22) in Tannenbaum. In your outline, do not give any details of page replacement disk I/O or the other standard details of page fault handling, and instead, concentrate on the details that are specific to the R2000. Assume that there is a pointer in a global memory location pointing to the page table of the current process, and ignore the problems posed by the use of the PID field

  3. Background The EIA RS-232 interface commonly used for asynchronous communications includes the following signals: If "EIA flow control" is used, the transmitter must raise RTS to indicate that there is data to be transmitted, and then await CTS before starting to send data on the TxD line. The transmitter must immediately cease transmission when CTS goes false, and the transmitter must de-assert RTS as soon as there is no more data to transmit.

    Assume you have an asynchronous transmitter comparable to the one documented in Problem 3, Homework 1. This requests an interrupt whenever the hardware transmit queue has space for another character. Assume also that there is a bit in some interface register that can be tested to get the state of the CTS line, and a bit that can be set to control the RTS line.

    The Problem: Assuming you were interested in a pure interrupt driven asynchronous transmitter using EIA flow control, what other conditions would you want the hardtware to detect, requesting an interrupt when they occurred. For each interrupt condition you identify, give a short paragraph identifying the function of the interrupt handler for that condition.

    Hint: There are at least two and possibly three conditions!