CS 3733 Operating Systems, Fall 2005 Assignment 4


Due Thursday, November 17, 2005

Assignment 4 has 3 parts.

This assignment builds on Assignment 3 and uses network communication. Instead of using pipes to communicate between client and server on the same machine, clients and servers on different machines will communcate over a network using UICI. Use the port numbers from Recitation 9 that can be found here.

If you have completed Assignment 3, this is a fairly short assignment. Try to finish it early. We will have one more assignment which will be due on November 29 and will be based on this one.

Each time you start a new part of this assignment, create a new directory. When you are finished, you should have an assign4 directory with subdirectories part0, part1, and part2. When creating one of these directories, start by copying into it the contents of the previous directory. Each time you write a main program, use lint and make sure you understand all of the warning messages. Save the lint output. Read this information about running lint. Review the comments from Assignments 1 and 3 and make sure you do not make the same types of errors.

Obtaining help
You are to do this assignment on your own, but you may ask me for help at any time. The earlier you start the assignment, the more help will be available. You may obtain help from me before or after class, by coming to my office, or by email.

Read through the entire assignment and look at the cover sheet before writing any code. You will be graded not only on the correctness of your programs, but their clarity and the methods you used for testing.


Part 0:
If you haven't done so already, complete Part 4 of Assignment 3. Copy your pserver, pserverp and pclient programs into the part0 directory of assign4. Also copy any of the other files you need and make sure they compile and run correctly.

Part 1:
Copy pserver.c into nserver.c, pserverp.c into nserverp.c and pclient.c into nclient.c. Modify these so they use network communication. Obtain copies of uici.c, uici.h, uiciname.c and uiciname.h. You can find these in Chapter 18 of USP. Modify the makefile accordingly. Look at the makefile for Chapter 18 to get an idea of what is needed.

The client program takes three parameters, the name and the machine running the server, a port number, and the number of requests to make. The same port number will be used for communication to and from the server. The client request is a short line sent to the server. Use anything you want for this line, as it will not be used by the server. The client does a timing calculation as before.

The server programs will take two parameters, a port number and the number of random numbers to generate. As before, it reads a line from the client and sends it to processline. Choose the parameters to processline appropriately. This function no longer needs to open or close a connection, but it does need to delay as before. It still sends a single line to the client containing the its process ID, the number of connections made so far, and an error count. Send 0 as the error count.

Test both of the servers as you did in parts 4 and 5 of Assignment 3. This time run the server on one machine and the clients on different machines. When running with 2 clients, run the clients on different machines so that you are using a total of three machines.

In this part you are running two tests, one with the serial server and one with the parallel server. Be sure to clearly label which is which in your output.

Part 2:
Have your servers simulate a mixture of CPU and I/O activity by having them sleep for one-half second before sending the message to the client. Use nanosleep. See the yield_thread function from the POSIX Mutexes notes on the web for an example of using nanosleep. Redo the tests in Part 1 with these servers. Does the parallel server do better than the serial server now? Explain why or why not.


Handing in your program:
Use this cover sheet. Consecutively number all of the other pages you turn in. Each page that contains your work should have a number on it. Make sure you have answered the questions from the cover sheet. Turn this in at the beginning of lecture on the due date.