CS 3733 Operating Systems, Spring 2001 Assignment 3 Comments
This assignment was graded on a basis of 30 points.
Part 1
- For ring.c the output is unpredictable.
It may always be the same on a particular machine, but the order of the
output is not determined by the program.
- For ring1.c the output is also unpredictable.
The last process will almost always output first (unless the machine
is so busy that it is delayed for more than one second by other processes.)
The other processes are able to finish at almost the same time and
to they can print in almost any order. Most likely, however, the
output will be in reverse order.
- For ring2.c the processes output in order unless they are
delayed by other processes for more than one second.
This is very unlikely. When the first process exits, the prompt is
displayed and this will usually be just before the output of the
second process.
- For ring3.c the output must be in reverse order since a process
cannot output until its child has terminated.
Part 2
- If the scheduling is non-preemptive, with the parent runs after the fork,
the processes output in order.
- This may also be the case for other scheduling, but it does not have to be.
- If after the fork the child goes first, the last process will output
first. The rest of the order is determined by the scheduling algorithm.
- If the print is not atomic, the output will be jumbled, unless the wait
is inserted. The wait forces the processes to print in reverse order.
General Comments
- If the parent of a process exits before the process does, it will
be inherited by init which as process ID 1.
- A large number of students got the extra credit, indicating that
either it was too easy or the inter-student communication was working
very well.
The extra credit was worth 2 points out of 30.