CSCI.4210 Operating Systems
Fall, 2004
Exercise 10.1, Deadlock

Here is a set of processes. Determine if deadlock is possible. If it is, show a set of interleavings which would produce deadlock.

Set 1
Mutex M1, M2, M3
    P1                      P2                     P3
    while (true) {          while (true) {         while (true) {
1.1     NonCriticalReg(); 2.1  NonCriticalReg();  3.1   NonCriticalReg();
1.2     MutexLock(&M1);   2.2  MutexLock(&M2);    3.2   MutexLock(&M3);
1.3     MutexLock(&M2);   2.3  MutexLock(&M3);    3.3   MutexLock(&M1);
1.4     CriticalRegion(); 2.4  CriticalRegion();  3.4   CriticalRegion();
1.5     MutexUnlock(&M2); 2.5  MutexUnlock(&M3);  3.5   MutexUnlock(&M1);
1.6     MutexUnlock(&M1); 2.6  MutexUnlock(&M2);  3.6   MutexUnlock(&M3);
1.7 }                     2.7 }                   3.7 }
RCS email: @rpi.edu