COP 5615 - Operating Systems

R. E. Newman, University of Florida

Project 2 - Multi-threaded Client-Server

DUE: February 19, 2014

Overview

Your first programming project was to write a simple server and a client using socket programming. For Project 2, you will revise that program to make both the client and the server multi-threaded. This will enable the server to handle multiple clients at the same time, and to maintain a persistent connection with a given client. It will also allow each server to contact other servers as a client in C-S communications, to exchange information with them as needed. Clients will also be able to receive multiple responses, and receive them from servers other than the one to which they initially connected. The program may be written in C, C++, or Java.

Actual files must be used for this project if they were not used in Project 1. A client will connect to a server, send the server requests to upload, read-lock, write-lock, release a lock, read, write, or delete a file from the system of servers. The client must also explicitly disconnect from the server when it is done, either due to the user making this request or the client process terminating.

The server will receive connection requests from one or more clients, and carry out the request if possible. In addition, servers will receive connection requests from other servers that forward requests from other clients.

An upload request for a file with the same name must produce an error unless the client holds a write lock on the file, in which case the existing file may be overwritten (the server may warn the client, which may ask the user whether to replace, make a second file with an altered name, or abort).

Each server will run in its own local directory, and will only access files in that directory directly. The servers must partition responsibilty for the uploaded files among themselves (e.g., by file name or by hash value), and a request to access a file that is not the responsibility of the requested server must result in the requested server forwarding (either directly or indirectly) the client's request to the server that is responsible. Contact information for the client must be included so that when the responsible server eventually receives the request, it can contact the client and provide an appropriate response.

The client may persist to send a sequence of requests to one or more servers. A client must be able to connect to one server and receive connections from it or from other servers that are forwarded the client's request. This will require that the client start at least two threads - one to make requests of a server to which it is connected persistently, and one to receive responses from the server responsible for the file the client has requested to access.

Servers must persist until they receive a request to terminate, handling requests from multiple clients and from other servers at the same time using multiple threads.

Program Requirements:

Documentation Requirements:

Bonus

An extra 20% bonus is avaliable if you also submit a Scala version within one week of the project due date.

Q and A