![]() |
![]() |
|
02152 Concurrent Systems Fall 2008 |
CP Mini Lab 3: Critical Region with Semaphores |
Home | Plan | Material |
To use semaphores to protect shared variables.
Read about semaphores in [Andrews], chapter 4.
The synchronization problem from CP Mini Lab 2 is now to be solved using semaphores.
Semaphore(int s0) // Constructor (sets the initial value, s0>=0)
void P()
void V()
[The operation P() may throw an InterruptedException. This should just be caught and ignored.]
Run the program again and find:
Enjoy!
Hans Henrik Løvengreen, Sep 19, 2008 |