CS 3733 Operating Systems, Spring 2005 Assignment 5 Comments
General Comments:
- This assignment was graded on the basis of 30 points.
- Basic operation of the program (without the extra credit) was similar to
assignment 3.
- Transfer file extra credit: worth 3 points.
5 students got credit for this.
- Using signals extra credit was harder, although any more students
attempted it.
- If I wrote OK in reference to this on your paper, it means that
you demonstrated it, and it seemed to work.
- This does not mean that you got credit for it.
- Only 2 students (out of about 15 who tried it) had it close to
being correct and got credit (up to 5 points) for this.
- Most attempted solutions had a server that looked like this:
- create a pipe
- fork a child to handle the communication
- child sends back information as a line through the pipe
- parent: after forking a child, read a line from the pipe
before going back to wait for additional connections.
- The above is a serial server since the parent cannot wait for
additional connections until the child is complete.
- If you are going to use a serial server, there is no need to
create a child or use a pipe to send information back to the parent.
- The two closest solutions used threads.
Each of these had some minor synchronization problems.
- To do this using forked processes and a pipe, one way is as follows:
- Create a pipe, and fork a child (pipe-reading child).
- The pipe-reading child only reads from the pipe.
- The parent does not access the pipe directly.
- Create a child for each connection.
- The parent immediately goes back and waits for the next connection.
- The connection-handling child writes information to the pipe.
- The pipe-reading child catches a signal.
You could use the same SIGUSR1 signal or use SIGUSR2.
- When the original parent receives a signal, it just sends a signal
to the pipe-reading child.
- When the pipe-reading child receives a signal, it displays the
required information.
- The pipe-reading child must block its signals while it is updating
the byte and file counts (after a successful readline).