CS 3733 Operating Systems, Fall 1996 Assignment 5


  • Due on December 3 at the beginning of class.

    In this assignment you will write a program that can generate a ring of processes on different machines.

    You should be using port numbers that do not conflict with those used by other students. Port assignments will be posted on the newsgroup.

    Start by copying the files in /usr/local/courses/cs3733/fall96/assign5 into one of your directories. You will give you copies of the files B.1, B.2, B.3, and B.4 from PUP appropraitely named. Also included is a makefile for compiling these. Try these out on two different machines and make sure that the client can send to the server.

    Now create a new program called netring which will be a combination of the client and server programs given to you. This program will take two command line arguments, the name of a machine to connect to, and a port number to use. It will listen for a connection on this port and also make a connection using the same port to machine whose name was passed on the command line. It should do the following:

    At this point you will have two open file descriptors which can be used for sending information around the ring in both directions. Now send a 64-byte message to the host that connected to you. This message will start with a character string containing the name of the host returned to you from u_listen. Now read the message sent by the machine you connected to. This will tell you your machine name. Print a message to standard output in the form:
    This program was written by x and is running on machine y.

    To test the ring connectivity, determine the size of the ring by sending information around the ring. It is up to you to design an algorithm for doing this. For example, each process can send a unique string around the loop and count the number of strings received before it gets back its string. Do not use the process ID for this as it is possible for two processes on different machines to have the same process ID. You can use the machine name.

    Print a second message to standard output in the form:
    This is machine y and there are n processes in the ring.

    Try you program out on 5 machines. Gather up the output from the 5 machines and hand them in as the next to last page of what you turn in. On the last page describe in detail the method you used to determine the number of processes in the ring. In the last paragraph of the last page state exactly what part of this project worked correctly and what part, if any, did not.