Q) What is a deadlock, and how can it be avoided?

Added on - 20 Sep 2019

Trusted by +2 million users,
assist thousands of students everyday
Showing pages 1 to 1 of 3 pages
Q) What is a deadlock, and how can it be avoided? Discuss several strategies for dealing withdeadlocks.Ans:Deadlock:Deadlock situation occur when there is a multiple processes are processed simultaneously bysystem. Deadlock is a situation that arises in a shared resource environment, where a processwaits for a resource for indefinite time because that resource is already occupied by anotherprocess. This situation comes under deadlock. For example: There are n number of transactionslike t1, t2...tn. T1 requires a resource that is x to complete its process or a task. But Resource x isheld by T2, and T2 is waiting for a resource y, which is held by T3. T3 is waiting for resource z,which is occupied by T1. So, all the transactions are waiting for each other to release resourcesto complete their processes. So being in this situation no transaction can complete their task orprocess. This point of situation is called deadlock.Strategies to deal with deadlock:1. Deadlock Prevention:to prevent deadlock situation in the system, the DBMS inspects all theoperations and determine whether transactions can create a deadlock situation. If there is anypossibility for deadlock situation, then tat transaction is never allowed to be executed. Here aresome scheme explained to prevent deadlock which uses timestamp ordering mechanism fortransactions in order to predetermine a deadlock situation.A)Wait-Die:according to this scheme, this allows the transaction requests to lock a resourcewhich is already held with a conflicting lock by another transition. Here are two possibilitiesIf TS(Tx) < TS(Ty) − that is Tx, which is requesting a conflicting lock, is older than Ty− thenTxis allowed to wait until the resource is available.If TS(Tx) > TS(ty) − that is Txis younger than Ty− then Txdies. Txis restarted later with arandom delay but with the same timestamp.This method permits the older transaction to wait for resource and to complete its processbut kills newer one.
desklib-logo
You’re reading a preview
Preview Documents

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Download This Document