A simple way to detect a state of deadlock is to construct a wait-for graph. One node is created in the graph for each transaction that is currently executing in the schedule. Whenever a transaction $\text{T}_i$ is waiting to lock an item $\text{X}$ that is currently locked by a transaction $\text{T}_j,$ it creates a directed edge $(\text{T}_i \# \text{T}_j).$ When $\text{T}_j$ releases the lock(s) on the items that $\text{T}_i$ was waiting for, the directed edge is dropped from the waiting-for graph.
Given the graph below, which is/are deadlock free?
64.3k questions
77.9k answers
244k comments
80.0k users