Advanced Programming: Concurrency, Lab 7
- Look at the following examples from Chapter 6:
Compile/compose each of these systems; then Run them and do
Safety and Progress checks on them. Make sure you understand
the results of these checks.
The first one deadlocks: thus there is bound to be a progress
violation too.
The second one has no deadlocks, and no progress violations
with the default progress check.
The third has no deadlocks, but with the given ProgressCheck in
place there is a progress violation: note that here the
ProgressCheck
in effect biases some of the choices (in favour of Time Outs)
and there are no progress violations for the default progress
check (which assumes fair choices)
-
Look at the Dining Philosophers, in both versions:
A different way to break the deadlock in the first version is
to have a doorman who will only allow up to four philosophers
into the room where the eating takes place.
Write a DOORMAN process which simply counts philosophers in and
out of the room (obviously PHIL must now perform
actions enter and leave in addition to all
previous actions). Compose this DOORMAN with the existing DINERS
composition -- call it NEWDINERS, for example -- and then see
what happens. (Note: in this version, DINERS will be using your
amended version of PHIL)