Lab 4 - Midterm review and Basic daemon code

Part 1 - Midterm review

The answers to the midterm will be discussed in class.

Part 2 - Basic daemon code

View the file http://www.cs.csub.edu/~marc/code/cs376/c376lab5.pdf and follow the instructions (items 1-3) for compiling and testing daemon.c from http://www.cs.csub.edu/~marc/code/cs376.html. You do not have to print out the program source unless you find it easier to read printouts than the screen. Do not answer the Assignment section. Answer the following questions instead.
  1. Unlike vcrec.c, which could only accept a single connection at a time, daemon.c can accept multiple connections at once. How does it accomplish this?
  2. Which signals will cause daemon.c to exit gracefully via parent_terminate()?
  3. Why does the ctrl-c signal not work to kill children processes?
  4. In dialog_with_telnet(), the actual work of sending and receiving data from the children processes is done. How does this code tell when you have terminated the connection?
  5. What is done to clean up a child process/thread upon termination?