Guardian Programmer's Guide

Table Of Contents
Coordinating Concurrent File Access
Guardian Programmer’s Guide 421922-014
3 - 8
Avoiding Multiple-Process Deadlocks
Process A acquires the lock on file 1. Process B acquires the lock on file 2. Now
process A would like to lock file 2 but cannot because process B has it locked.
Process B can never release the lock it has on file 2 because it is waiting for a lock on
file 1, which process A can never release.
You can avoid this kind of deadlock by careful programming practice, as shown in
Figure
3-3.
Figure 3-2. Two Processes in Deadlock
VST016.VSD