-- Lab
#6 --
-
Objectives
- This lab gives you the chance to experiment with
semaphores and monitors in the context of classic concurrent
programming problems such as Bounded Buffer and Readers and
Writers.
-
References
- Sun's Java Tutorial on threads: synchronization
Silberschatz, Galvin & Gagne: Chapter 7
-
Pre-Lab
- Copy the source code
Server.java,
Worker.java, and
Semaphore.java. Read the program and understand
what the program is trying to do. Run the program a few times to
observe the behavior of the program. First identify in the code
of Worker what is intended as the critical region
(CR). The existing program doesn't
actually use the Semaphore to protect the critical
region(s) yet. Add the necessary code to use the
Semaphore to protect the CR. Compile and run the program
again to see if it makes any difference.
Hand in a printout of the code for the Worker
class at the beginning of the lab.
You should also review Sections 7.6.1 (a semaphore solution to
the bounded buffer producers and consumers problem) and 7.8.3 (a
solution to the readers and writers problem using Java
synchronization) before the start of lab. It will be useful to
bring your text to lab.
This document was generated using the
LaTeX2HTML translator Version 2002-2-1 (1.70)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -nonavigation -split 1 prelab
The translation was initiated by CS315 on 2004-02-21
CS315
2004-02-21