Readers/Writers Problem due Tue 26 Feb 13:20

\begin{purpose}
This assignment provides an opportunity to apply a solution to ...
...ion. Also you will work
with and modify networking code in Java.
\end{purpose}

This assignment is based, in part, on the classes given in homework #2. You will modify an existing multi-threaded database server to properly enforce mutual exclusion. You will also modify the client/server protocol to provide a mechanism for graceful exit when the thread pool is used.

Provided Code

You will need to pull the latest code from the original homework repository to add the hw03 directory and its files to your homework repository (git pull origin if you are working from the original instructions).

Within hw03 is a directory called doc that contains documentation of the set of provided classes as produced by the javadoc tool. You will want to browse the documentation and also spend time looking at the extensive provided source code. Also, take some time to compile and run the client and server programs. Once you have a decent understanding of the existing code you will be ready to start the assignment.

Improving Client/Server Relations

In the current program, when a server reaches its limit for number of threads it allows, the client is still allowed to connect. The client will continue to run until it makes a request of the server at which point it crashes. Modify the protocol (and the client code) so that when a client connects, it will gracefully exit with an appropriate message in the event that the server is busy. This change should be included in both versions of the program outlined below.

Critical Sections

There are multiple threads that access the database concurrently. Accesses can involve modifying the database or reading the database. This is an instance of the classic readers/writers problem. You should implement two solutions to the problem:
  1. enforce mutual exclusion appropriately while maximizing concurrency by using semaphores (put all needed files in a directory called ``semaphore'' within hw03)
  2. enforce mutual exclusion appropriately while maximizing concurrency by using monitors (put all needed files in a directory called ``monitor'' within hw03)

Turning in the Program

You will submit your program by posting your work to your bitbucket.org homework repository.

I will grade you source code according the following criteria:

Correctness/Completeness 24 pts
Documentation 2 pts
Java Conventions 2 pts
Use of VCS 2 pts
Total 30 pts