written 7.9 years ago by |
Deadlock is a permanent phenomenon. If one exists in a system, it will not go away unless outside intervention takes place. This outside interference may come fron the user, the system operator, or the software system (the operating system or the distributed DBMS). A deadlock can occur because transactions wait for one another and occurs when the WFG contains a cycle.
For a deadlock to occur, each of the following four conditions must hold.
i. Mutual Exclusion
ii. Hold and wait
iii. No preemption
iv. Circular wait
WFG(Wait for graph)
A useful tool in analyzing deadlocks is a wait for graph. A WFG is a directed graph that represents wait for relationship among transactions. The node of this graph represents the concurrent transactions in the system. A edge Ti | Tj exists in the WFG if transaction Ti is waiting for Tj to release a lock on some entry.
We should indicate that the formation of the WFG is more complicated in distributed systems, since two transactions that participate in a deadlock condition may be running at different sites. We call this situation a global deadlock. In distributed systems, then it is not sufficient that each local distributed DBMS form a local wait-for graph at each site; it is also necessary to form a global wait for graph which is the union of all the LWFG.
Methods of handling Deadlock
There are three known methods for handling deadlocks: prevention, avoidance and detection and resolution.