CS 3733 Operating Systems, Spring 2006 Assignment 4 Comments
This assignment was graded on the basis of 30 points.
- Handle errors on all I/O.
- Global variables should have static linkage.
- No more than one declaration per line.
- Do not return negative values from main.
- In testing part 3, send at least three signals, one before any compiles
one after a compile and one after another compile.
- In the signal handler, save and restore errno.
- How to print a number in a signal handler:
- Use write along with your own conversion function.
- Use fprintf but don't use it or any I/O or string functions
in the main program without blocking the signal.
- Create a message to be printed in the main program and print it
with write.
This produces critical sections.
Block the signal while preparing the message.
- How to do Part 3
Problem: main program keeps count but the child
(the one that waits for the exec'ed program) gets the return status.
- When cleaning up zombies, get teh status.
If you just do a normal wait without the NOHANG
the server is now a serial server.
- Use a signal to send the status back to the main program.
- Send the info through a pipe which is read by the signal handler.
You need to be careful, and either use non-blocking I/O or
have the signal handler also write to the pipe so you know when to
stop reading.