CS 3733 Operating Systems, Spring 2006 Assignment 4


Revised due date: Due April 21 - no late assignments, must be turned in by the start of class.

In this assignment we will convert your Assignment 3 into a parallel make that can be used over a network. In this assignment all compiles will be sent to a single compile daemon. In the next assignment you will be using multiple compile daemons. When testing, use one of the port numbers assigned to you. You can find the list here.

Use this cover sheet as the first sheet when handing in your assignment. Make sure you include your makefile and lint output.

This assignment has several parts. Each time you start a new part, create a new directory for the programs and copy all of the programs from the previous part into this directory.


Part 0: Obtain copies of serverp.c and client.c from the USP web site. Also get copies of all of the other files needed to compile these. Put them all in a part0 directory along with a makefile that can be used to compile and lint these programs. Test them and make sure they are working.


Part 1: Modify your compile_daemon.c program so that it is a parallel network server. Model it after the serverp program. It takes 2 command line parameters, a path (as before) and a port number. It waits for connections on the given port and for each one, it forks a child. The child reads a token from the network and performs a compile as before. This child will fork its own child to do an evec. When the compile is complete, the original child sends back a single byte on the network as before. Make sure you are careful to have to original parent process close the appropriate file descriptors and clean up after zombies.


Part 2: Modify your compile_all.c program from Part 4 of Assignment 3 so that it communicates with your compile_daemon.c program from Part 1. For now, hard code in the name of the machine you are running your compile_daemon.c on. The program takes at least 4 command line parameters, the first being a port number and the second being a file name which will be ignored for now. The rest of the parameters are as before. For each of the additional parameters, make a connection to the compile_daemon on the hard-coded host and send the token. Then wait for 1 byte on each connection and proceed as before to compile the executable as in Part 4 of Assignment 3. For now, the path of the C compiler can be hard coded into your program.


Part 3: Modify your compile_daemon.c program so that it starts by displying its process ID and sets up a SIGUSR1 signal handler. When it receives a signal, it displays the number of successful and unsuccessful compiles it has done. Test your program and produce output showing your test results. Annotate the output to indicate what it shows.


Part 4 (Extra Credit - easy): Modify compile_daemon.c so that when it receives a signal it displays on a separate line the name of each file that it has compiled and whether that compile was successful.


Part 5 (Extra Credit - harder): Modify compile_daemon.c so that when it receives a signal it also displays any error messages that were produced by the compiler for each compile.