CS 3733 Operating Systems, Spring 2003 Assignment 4 Comments
The assignment was graded on a basis of 40 points.
If there is anything you don't understand, see me.
- Some people still do not understand how to tell whether Part 1 is
working. For a maximum of 3 processes, the output would often look like:
      Start
      Start
      Start
      End
      Start
      End
      Start
      ...
      End
      End
      End
- Do not block the signals during the readline.
This can indefinitely delay a signal from being caught
- A signal handler must have either 1 or three arguments depending on
whether it is set with SA_SIGACTION clear or set.
- Do not use the argument in the signal handler just to eliminate
the lint warning message.
- In Part 2 your program has a critical section in the signal handler
and the main program when the data structure holding the list is modified.
- The simplest way to protect this critical section is to block the
SIGUSR1 signal before modifying the structure. Unblock the signal
when the modification is complete.
- You should save and restore errno in the signal handler.
- When testing, be sure to test the case in which signals are delivered
before the last process starts.
- Don't allocate a pointer and malloc memory unless necessary.
Normally, malloc is used when the amount of memory needed is not known
during compile time.
- The simplest implementation of Part 2 is to allocate an array of structures
of n entries, where n is the maximum number of running processes.
If instead, you use a linked list, it makes Part 4 almost trivial.
Instead of deleting entires, mark them as finished.
- readline should not use global variables.
- You don't have to test with very long lines if you make your initial
buffer have a small size.
- readline should not exit the program under any circumstances.
- For Part 5, write a function:
     
int int2str(int n, char *buf)
That creates a string in buf corresponding to the integer,
n. Return the length of the string. You function can assume
that buf is large enough.