Programming
Project I
CS 6210
Advanced Operating Systems
Spring 2002
Due Date: January 22, 2002 by midnight.
The primary goal of this project is to build a multithreaded
application that requires sufficient programming
effort to get you ready for future projects that will be assigned in the
class. You will also learn how to use the Pthreads library to create a
multithreaded application. This library is available on most platforms.
The specific goal of the project is to build a highly
simplified web server. Clearly, a web server handles requests that come
from remote clients. In this project, you do not need to worry about remote
nodes and distributed programming. However, since a web server handles
requests for documents stored at it using the hyper text transfer protocol
(http), you will have look up http and the messages that
can be exchanged using this protocol between a client and the web server.
Your server will read such requests from a file. Each request will have
all the information associated with it. Also, documents on the server are
typically stored on disk. You will make use of a large file to simulate
the disk. Hence, disk operations will be translated to read and write requests
to the ?disk file?.
The server will be multithreaded and it will perform
a number of functions to efficiently provide the documents that are requested
by clients. The server will consist of the following functions, each of
which will be implemented by one or more threads.
-
A dispatcher thread will read client requests. A delay should be
introduced between reading client requests to mimic the asynchronous arrival
of client requests.
-
The dispatcher thread will hand off requests to a resolver thread.
This thread will translate URLs to local document identifiers. The local
identifiers can be assumed to be between 0 and n.
-
Once requests are translated to local document identifiers and other checks
are done, the resolver will add the requests to a work queue that contains
pending requests. A number of worker threads will process these
requests.
-
The server will employ a cache of recently accessed documents to improve
performance. A cacher thread will implement an approximate LRU replacement
algorithm to decide what documents are kept in the cache. You can set the
cache size so that the fault rate is low (e.g., below 20%).
-
You can employ one or more GUI threads that show the contents or
other information and requested documents are returned. These threads will
take actions similar to what a client will do with the received document.
You can also use additional threads if that helps
you structure the server better or to provide better performance or scalability.
Obviously, to successfully complete the project, you
must understand how threads work and are synchronized using locks and condition
variables. When it is better to block a thread rather than busy wait, you
should make use of condition variables.
To test the program, the TA will use an input file
that is a sequence of http requests. Other information such as URL names
etc. will be provided to you next week. You should generate suitable output
to demonstrate that your implementation handles the requests according
the specification of the project.
New added
The input file is provided
by yourself when you turn in your project. For example, the format will
look like
GET /path/yourfile1
HTTP/1.0
PUT /path/yourfile2
HTTP/1.0 sourcefileToPut
You don't need to zip the sourceToPut files in
your turn-in. But in the input file you turn in, please give the sourcefileToPut
file the required name like 1.txt, 2.txt, 3.txt, and so on. So I will
provide the content of those sourcefileToPut.
In a report that needs to be submitted with an online
copy of all code and test files, you need to briefly discuss the threads
that are crated by your implementation, the major data structures and how
they are shared, and details of the code that is executed by each thread.
The TA will provide details of how the projects should be submitted.
TURN-IN:
This is one minute prior to midnight
on Tuesday night. No late assignments will be excepted
unless prior arrangements have been
made.
Assignments will be submitted by e-mailing
a tar archive of your work to the account
cs6210@cc.gatech.edu. Instructions
for creating a tar file will be posted to the newsgroup. Make
sure that you do NOT include any binaries
in your tar files. I am going to compile your programs
from scratch. If you have any special
commands needed to compile your code then mention them
in your README file.