CS 3733 Operating Systems, Spring 1999 Assignment 5
Warning: This is not for the current semester.
Due Friday, April 23, 1999
Note: The last assignment will be given out about a week before this
one is due. You should start this one early so you will have time tom complete
the last one.
Overview
In this assignment you will modify the previous assignment so that it
keeps track of some statistics and sends them to another process using
real time signals. Start with part 4 of assignment 4. You might want to
use a separate directory for each part of the assignment.
Part 1
Modify void header_filter so that it keeps track of two integer values,
the total number of bytes received and the number of header lines found.
It should store these values in the info buffer that is passed
to it as a parameter. This will allow it to separately keep track of data
for the upstream and downstream communications. Modify the main program so that
it prints its process ID when it starts up. The value will be used in Part 3.
Test this using fprintf statements in the appropriate places.
Part 2
Modify the program so that it can receive realtime signals SIGUSER1
and SIGUSER2.
When it receives a SIGUSR1
signal it interprets this as the process ID of a process to receive information
about the upstream communication. It sends to this process two real time
signals. It sends a SIGUSR1 signal with value equal to the number
of upstream communication bytes and it sends a SIGUSR2 signal with
value equal to the number of upstream header lines.
Similarly, when it receives a SIGUSR2 signal it sends two signals
containing information about the downstream communication.
Part 3
Write a main program which takes 2 command line parameters, a process ID
and a signal number. It sends the specified realtime signal to
the specified process. The value sent is the PID of the sending process.
In then waits for signals to come in.
When a realtime SIGUSR1 signal comes in it displays a line in the form:
Number of data bytes is xxx
where xxx is the value sent with the signal.
When a realtime SIGUSR2 signal comes in it displays a line in the form:
Number of header line is xxx
where xxx is the value sent with the signal.
Test two copies of this with the programs from Part 2 and turn in sample output.