Author: Ron K. Cytron
and David Jurgens
| || 1 ||Apr
|| 2 ||Apr
|| 9 ||Apr
|| 9 ||Apr
In this lab you will develop some software components based on
the lecture material. These components will be incorporated into a
client/server multi-user game in the ensuing weeks.
While in future weeks you may work with a partner, for this section
you are to submit your own work. You are free to discuss implementation
strategies with colleagues, but the work you turn in is to be your own.
By the end of this lab, you should
- Understand how to use
to ensure a precondition holds for a given operation.
- Understand how to achieve race-free classes without obtaining locks.
- Read this entire document before you start.
- Review the lectures and readings on condition variables and
- Read over the JavaDoc for this lab.
There is much more in the JavaDoc than you need for this part; please
concentrate on the pieces due for 6a.
- Run the sample solution
[[[ Download PC zip if you have not started]]]
[[[ Download PC zip for demo classes]]]
- Classes you are given, and need not modify:
- Classes you do not implement, but modify as part of this lab:
You have to augment this class to do some new things as
described in the class's JavaDoc. You also have
to make it thread-safe without getting a lock.
- Classes you do implement (stubs are given):
Complete the classes as described in the JavaDoc.
Queue class is not documented, but there is a test included
in that file (just run the file), so you can see how it works. A thread
that tries to
dequeue an object blocks until some object
shows up in the queue.
What to turn in:
- A code cover sheet.
- Any Java files you have created or modified for this part.
Last modified 12:38:05 CDT 08 April 2003
by Ron K. Cytron