Concurrent Programming (19530-V)Dr. Richard S. Hall WS 01/02- Übung 6 -Assigned: 4.12.2001Due: 11.12.2001 |
1. Exercise a) How do you create a mutual exclusion lock with a semaphore?b) In the Java Semaphore class from the lecture, why is it okay to call notify() instead of notifyAll() in up()? c) What causes the nested monitor problem? d) What causes deadlock? e) How does ordering the acquisition of resource types avoid deadlock? 2. Exercise Using the Java code for Counter and Semaphore from Lecture 6, implement a StrictCounter (a counter that does not ignore increments/decrements) using semaphores rather than condition synchronization.
3. Exercise The figure below depicts a maze. Write a description of the
maze in FSP and then use the deadlock analysis of LTSA to find the shortest
path out of the maze starting from any position. (Hint: At each number in the maze, a directional
action (i.e., north, south, east, west) can be used to indicate an allowed path to another number.)
|