Assignment 11, due Apr 28

Part of the homework for 22C:112, Spring 2008
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: See the assignment for MP6 and the code distributed with that assignment.

    Note, in this code that, before each call to copy(), both ends of the pipe are closed, and that Note, in this code that, before each call to copy() copies from stdin to stdout.

    a) Explain exactly what change the program does to the input as it copies it to the output. Feel free to compile and test this code to answer this question. (0.5 points)

    b) Given that the descriptors returned in creating the pipe are all closed before the call to copy(), and that copy() copies from stdin to stdout, explain how the data can flow through the pipe. (0.5 points)

  2. Background: Our Linux implementation includes a number of semaphore operations, summarized under sem_overview in part 7 of the programmer's manual.

    A Problem: Evaluate the appropriateness of these semaphores with regard to the synchronization requirements of machine problem 6. (1 point)

  3. Background: Dekker's solution to the mutual exclusion problem only solves the problem for two competing processes.

    A problem: How can this be generalized to an arbitrary number of processes? Show that you understand this by explaining how to use it for 5 processes that must compete to enter a critical section. (1 point)