parallele-programmierung/u06-3/README.md

647 B

Problem 6.3: Dining philosophers with globally uniform acquisition order

As mentioned in the lecture, one possible strategy to avoid a deadlock is to acquire all resources in the same, globally uniform order, so that it cannot happen that e.g. thread A first acquires resource 1 and then resource 2, while thread B acquires the same resouces in a different order (first 2 and then 1).

Implement a deadlock-free solution to the "dining philosophers" problem from the lecture using this strategy by defining a globally uniform acquisition order for the fork semaphores; an additional semaphore as in the lecture will no longer be necessary then.