CS 3733 Operating Systems, Fall 2005 Assignment 5


Due Tuesday, November 29, 2005

Assignment 5 has 6 parts, some of which are very short.

This assignment builds on Assignment 4. In the last two assignments you started 2 clients at the same time. You did this by hitting return in one window and then moving the pointer to another window and hitting return again. This procedure is not very accurate and would not scale up to 10 or 100 clients. In this assignment we will modify the clients so that they can be started at the same time. You will also design a means for collecting the data generated by all of the clients and displaying this data on a single machine.

Motivation

To test the performance of a server, it is often necessary to use multiple clients running on different machines. These clients need to be started as close together as possible. Each client gathers data on its communication and these pieces of data must then be analyzed on a single machine. We need to make sure that the network used to transmit the data does not interfere with the testing of the server, so a client will need to not send until all of the other clients have finished sending requests to the server.

In this assignment we develop a mechanism for:

  1. starting the client at close to the same time
  2. having the clients gather timing data about their communication with this server
  3. sending the data to a common machine, only after all of the clients have finished communicating with the server

Part 0:
If you haven't done so already, complete Part 2 of Assignment 4. Copy all of the programs into the part0 directory of assign4 and make sure they compile and run correctly.

Part 1:
Modify nclient.c so that it takes a fourth parameter, a second port number. Before it starts the loop to make connections to the host, it waits for a connection on the second port number. Your client program is now also acting as a server.

Write a new program called nstart.c which takes a port number and and arbitrarily long list of hosts as parameters. For each host parameter, make a connection to the corresponding host using the given port number.

Use your nstart to start three copies of nclient on three machines, each communicating with the same server as you did in Part 2 of Assignment 4.

The following description was added to clarify what this means:
Manually start 3 copies of nclient, one on each of three different machines. Run nstart and have it communicate with these clients so that they start communicating with the server at about the same time.

Part 2:
Modify the nclient program so that after it has computed its timing information, it sends a single byte back to the nstart program using the second port number. It does not matter what the value of this byte is.

Modify nstart so that after making the connection to all of the hosts, it tries to read one byte from each host. Do this serially. When all of the bytes have been read, print a line to standard output indicating that all clients have completed their communication.

Part 3:
Modify nstart so that after it receives one byte from each client it sends a single byte to each client.

Modify the nclient program so that after it sends a byte on the second port, it tries to read a single byte from this port. Have it print a message to standard output when this has been done.

Part 4:
Modify nclient so that after it has done all of this it sends two integers back on the second port, the number of requests mades and the number of microseconds to complete the requests. You can use any format you like but it should be hardware independent. The communication should work even if the communicating machines have ints of different sizes or have different endianness.

Modify nstart so that after it does what it did previously, it reads two integers from each host and displays a table of three columns containing the host name, the number of requests sent by that host, and the time in microseconds for that communication.

Part 5:
Modify the two servers (nserver and nserverp) to eliminate all calculation and sleeping before sending the message back to the client. The servers will ignore the second parameter. Modify nclient so that the loop being timed contains the requests to and responses from the server, but as little else as possible. Obtain timing results for each of the two servers using 3 clients.


Handing in your program:
This program will be demonstrated in the lab on the due date during the usual class time. The usual 12-hour late period does not apply to this assignment. Instructions for doing the demonstration appear below.