CS 3733 Operating Systems, Spring 2011 Assignment 5


Assignment 5: Due Thursday, April 21

This assignment is a continuation of Assignment 4.
You will find solutions to the n-queens problem by distributing the solution over our network.


Part 1: The server
Write a parallel UICI server. The server should have one command line parameter, the port number it will listen on. When a connection is made it receives 2 integers from the client, one representing n and the other representing first. It then calls a function generate_n_queens_serial_one from Part 3 of Assignment 4. When the function is done, close the connection. You can use any appropriate format for encoding the data as long as it is machine independent. If you send the data as strings the program can be tested using client2. For testing, you can use an appropriate value of the second parameter.

When this is working, modify it so that instead of printing the results, it sends them back to the client in an appropraite format. It should send the correct solutions back to the client as they are generated rather than waiting until it has found all of them. You can remove the second parameter from generate_n_queens_serial_one since it will not be used.


Part 2: The client
Write a client for use with your server in Part 1. In this part the client will have 3 command line parameters: n, port and host. It will send n requests to the host, each asking to do one part of the n-queens solution. Get the results back and display them along with the count of the total number of solutions found.

You must implement the above in a safe and parallel way. The connections should proceed concurrently (not serially) and you should print out the results as they become available. You can use threads or forked children, but make sure that all critical sections are protected.


Part 3 Using multiple servers
Modify the client (by copying the code and keeping a copy of the client you used in part 2) so that the last parameter is the name of a file containing a list of hosts to use. Farm out the requests to these hosts in a circular fassion, wrapping around if the number of hosts is less than n. Test this for various small values of n before trying 12, 13, 14 or larger values.

Be kind to your fellow students. Do not use more than a handful of machines and do not leave any servers running when you are done.

Write a description of the communcation protocol that you have chosen to use. It should have enough detail so that someone can write a client that will work with your server or write a server that will work with your client.

Write a paragraph describing how you implemented the concurrency requirements of Part 2, what synchronization issues you had to resolve, and how you handled them.

Test the program with various values of n and various numbers of hosts. Calculate the speedup obtained for various values of n and number of hosts. Write a paragraph describing your results.


Handing in your assignment
Use this cover sheet.