Homework 11

22C:116, Spring 1999

Due Friday Apr 23, 1999, in class

Douglas W. Jones
  1. Background: Consider the following new component for our user-level thread package:
    ssize_t thread_read( nt fildes, void *buf, size_t nbyte )
    
    A call to thread_read() has exactly the same semantics as a call to the standard Unix kernel routine read(), except that, if there are other ready threads, thread_read() blocks only the calling thread. If there are no ready threads (other than the calling thread), a call to thread_read should block the calling process until data is available.

    Problem: Propose an implementation for thread_read(). Hint: An implementation based on a busy-waiting loop that calls thread_relinquish() once per iteration is acceptable, and use of the O_NONBLOCK flag (settable by fcntl(,F_SETFL,)) is reasonable.

  2. A Question: Does the University of Iowa Division of Mathematical Sciences maintain a distributed file system, or just a network file system? Justify your answer!

  3. Background: Consider a distributed file system based on a 2-level structure -- low-level files are accessed by file-number, and a directory is merely a file used by a directory server to relate textual file names to low-level file numbers. When a user sends an open() message to the directory server, it replies by giving the user a file number. The read() and write() services, provided by low-level file servers, operate on files by their numbers and have no knowledge of file names.

    Part A: Where does the responsibility for security lie in such a system?

    Part B: Suppose we demand that our system use garbage collection to reclaim disk space filled by files that are no-longer usable. Is this demand reasonable? Specifically, what information must be available to the garbage collector in order to assure that it never collects the space occupied by a file that some user can still access.