Concurrent Programming (19530-V)Dr. Richard S. Hall WS 01/02- Übung 3 -Assigned: 6.11.2001Due: 20.11.2001 |
2. Exercise A recursive lock is a lock that when acquired by a process can be acquired again and again by that process without the process having to release it before re-acquiring it. Conceptually, the lock keeps a counter of how many times it was acquired by the same process and the lock is only freed after an equivalent number of releases have occurred from the same process. Given the following declarations: const N = 3 Model a recursive lock as an FSP process called RECURSIVE_LOCK with the alphabet {acquire[p:P], release[p:P]}. The action acquire[p] acquires the lock for a particular process p. 3. Exercise A central computer connected to remote terminals via communication links is used to automate seat reservations for a concert hall. A booking clerk can display the current state of reservations on the terminal screen. To book a seat, a client chooses a free seat and the clerk enters the number of the chosen seat at the terminal and issues a ticket. A system is required which avoids double-booking of the same seat while allowing clients free choice of the available seats. Construct a model of the system and demonstrate that your model does not permit double-bookings. Your TERMINAL process should allow the customer
to choose a seat, at which point the process should query to determine if
the seat is reserved or not. If the seat is not reserved, then it should
be booked otherwise nothing changes. |