CS 3733 Operating Systems, Spring 2006 Assignment 3 Comments

This assignment was graded on the basis of 30 points.

  1. The order in which the compile daemons respond is not important since you are just interested in the number of successes and the number of failures.
  2. Question 5c) Is your program correct?
    This question does not ask whether your program compiled correctly.
    In order to be a correct program, it must behave correctly in all cases, independent of the way processes are scheduled.
    See the answer to 5e).
  3. Question 5e): You should have found that when you put a sleep in the read_token loop, the compile_daemons did not get the correct tokens.
  4. In read_token, you must check for an end of file or a read error.
  5. In read_token you must prevent a buffer overflow from occurring.
    It is not sufficient to first overflow the buffer and then check to see if it happened.
  6. Do not print any messages in read_token.
    This returns 0 on success and -1 on failure.
    It is up to the calling program to handle the error.
  7. Some people are still missing the point of this assignment and doing the compiles serially.
    You need to write all of the tokens before reading any of the replies.
  8. Whenever you call malloc you should check the return value to see if it is NULL.
  9. You do not need to malloc or copy the token in compile_all.
    Since only one process is writing to the pipe, write the token to the pipe and then write the delimiter.
  10. Some students still do not know what NULL means.
    It is a pointer, not the string terminator.
    Would you consider the following string copy correct:
        for (i=0;a[i]!=STDIN_FILENO;i++)
            b[i]=a[i];
        b[i] = STDIN_FILENO;

    We know that STDIN_FILENO is 0, so the code runs correctly, but it is not good programming.
    In place of STDIN_FILENO we could have used INADDR_ANY or any other constant that just happens to be 0.