CS 3733 Operating Systems, Fall 1999 Assignment 3


Warning: This is not for the current semester.


Due on November 9 at the start of class

Part 1
When turning in assignments use the cover sheet that will be available in /usr/local/courses/cs3733/fall1999/cover3.ps and make sure that the cover sheet is completely filled in. The cover sheet indicates what must be handed in for this assignment. All source code should be printed with two pages per side. Use something like prtext to do this.


From PUP, section 4.1 starting on page 147:
Do all parts except for the last two (bidirectional ring and torus). Modify the first program (called ring.c) so that it starts by printing a message to standard error in the form:
This program was written by ...
and modify the message printed out at the end of the program by each process so that it prints its child process ID also:
This is process n with ID x, parent ID y, and child ID z
If the process has no child, it should print -1 for the child ID. Use this as your basic ring.c program.

You can get a copy of the original ring.c that is in the text from /usr/local/courses/cs3733/pup/ch04.

You will be capturing output for each program in this assignment. When capturing sample output do not use redirection. This will affect the behavior of some of the programs. Use cut and paste to pick up the output to your screen.

Prepare a summary report with your output and explanations. This report should be on consecutive pages near the beginning of what you hand in. For each of the programs ring.c, ring1.c, ... ring6.c, include sample output and write at least one sentence describing how the modification affected the output. Do not include source code with the summary. The source code should be handed in, but it should be at the end of the packet you hand in.

Your summary should also include the following:

  1. For ring3 describe the output in your own words. Make sure you use a large enough value of the second parameter. Indicate the size of the parameter and which machine you ran it on. The fprintf referred to in this part is the last on in the program, not the ones involved in reporting errors.
  2. For ring4 specifically indicate how the output differs from that of ring3.
  3. For ring5 include sample output and describe how this differs from ring3.
  4. For the last part, call the program ring6 and include sample output and describe the results. Are they what was expected?

Part 2
Copy ring3.c into ring7.c and modify it as follows. Before the sprintf, have one of the processes write a byte to standard output. Then have each process read a byte from standard input. After the call to prtastr have each process write a byte to standard output before exiting. Run both ring3 and ring7 with values of the second parameter which cause output problems for ring3. Hand in sample output and describe what happened and why.