Threaded Query Server due Mon 12 Feb 13:20

\begin{purpose}
In completing this assignment the student will:
\begin{itemize...
...rent threads to query a non-standard
database
\end{itemize}\par
\end{purpose}

Overview

This assignment explores a possible use of threads in the implementation of a simple query server. You may find it useful to play around with Java threads prior to attempting this assignment. There is a good bit of code provided in a repository as a starting point. Most of the provided code should be considered immutable (should not be changed). Documentation for the existing code is available at

https://josephus.hsutx.edu/classes/os/source/bookdb-documentation/

Using git for Homework

The starter code for this and future assignments is provided in the following repository: https://tsergeant@bitbucket.org/tsergeant/os_homework.git The files for this assignment can be found in the hw02 directory of the repository.

You should clone this repository into your own BitBucket account and then share your copy with me (terrys@gmail.com) and give me write access. For later assignments you'll need to pull additional files so it will be convenient to set in your local work space remotes referring to both the original repository and to your version of the repository. NOTE: If you don't remember how to make all this happen you can follow the instructions in the first three sections of Using git for Homework.

Provided Code

You will do your work in the hw02 directory of your os_homework working repository. Take some time to compile and run the starter program. Then study the source code to see how it works. The link to the online documentation provided above will likely prove helpful. Once you have a decent understanding of the existing code you will be ready to start the assignment.

IMPORTANT: DO NOT CHANGE ANY CODE IN THESE FILES: Book.java, BookDatabase.java, and SearchRequest.java. You will not receive full credit for this assignment if git indicates any of these files are modified.

Program Behavior

The final program will load the database and prompt the user to enter a search string. The program will search for the specified value in each of the five fields that exist in the database. Once the results have been displayed the user will be prompted to enter another search string. This continues until the user simply presses <Enter> to indicate they are done searching. A transcript of the results of running my version of the program against the database is given at the end of this assignment.

In the provided hw02 directory you will find a file named bookdb.out that contains a transcript of my program for a variety of search values. This will give you an indication of how the program should function. Notice that in some search results the output from different threads is interleaved.

What About Threads?

Here's how I would like you to use threads. When the user enters a search string create five separate threads to perform the search. You will assign one thread for each field. Thus, the database will be searched ``simultaneously'' on each field. Although you will have five threads, they should all be of the same type and upon creation you should designate the field upon which the thread should search. The actual search performed by the thread will be accomplished by calling the appropriate method of the BookDatabase object.

In the case that a thread finds a match, it should display the matching entry together with the field upon which the match was found. Then it should continue searching that field for additional matches.

In the driver program the threads should all be started prior to issuing any joins. Once the threads have finished you will prompt the user to enter another search string.

Turning in the Program

As part of these instructions you will have created and shared a private repository with me that was initially created by cloning the provided os_homework repository. I will grade the source code found in that shared repository according the following criteria:

Correctness/Completeness 22 pts
Documentation 2 pts
Java Conventions 2 pts
Setup and use of git 4 pts
Total 30 pts