SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
Prepared by-
Name : Vardhil Patel
Guided by: Prof. _____________
Gandhinagar Institute of
Technology
Subject: DBMS
Deadlock
Contents
1. What is Deadlock?
2. Deadlock Prevention
3. Deadlock Detection
4. Recovery of Deadlock
What is Deadlock?



A system is in a deadlock state if there exists a set of transactions such that
every transaction in the set is waiting for another transaction in the set.
None of the transaction can make progress in such a situation.
The only remedy to this undesirable condition is for system to invoke some
drastic action,such as rolling back some of the transactions involved in the
deadlock.

There are two methods for dealing with deadlock
1.Deadlock Prevention.
2.Deadlock detection & Recovery.
Dead Lock Prevention
●
●
●
●
●
There are two approaches to deadlock prevention.
One approach ensures that no cyclic waits can occur by ordering the
requests for locks.
Second Approach is the rollback of transaction.
The simplest scheme under the first approach requires that each
transaction locks all its data before execution.
Moreover,either all are locked or none.
●
Another Approach for preventing deadlocks is to impose an ordering of
all data items,and to require that transaction lock data items in
sequence.
Preemption-Prevention to
Deadlock
●
●
●
The second approach for prevention of deadlock is preemption and
transaction rollback.
In preemption when a transaction,when a transaction T2 requests a lock
that transaction T1 holds,the lock granted to T1 may be preempted
by rolling back of T1 and granting of lock to T2.
Two different deadlock prevention Technique using Timestamps
1.Wait-Die Scheme
When a tranasaction Ti requests a data item currently held by Tj ,Ti is
allowed to wait only if it has a timestamp smaller than Tj.Otherwise
Ti is rolled back.
2.Wound-Wait Scheme
When transaction Ti requests a data item currently held by Tj ,Ti is
allowed to wait only if it has timestamp larger than that of Tj.
Otherwise Tj is rolled back.
Dead Lock Detection
●
●
Deadlocks can be described precisely in terms of a directed Graph
called wait-for Graph.
Wait-for Graphwith no cycle
Wait-for Graph with Cycle
T26
T25
T27
T28
T25
T26
T27
T28
Recovery From Deadlock
●
●
●
When a detection algorithm determines that a dead lock exist,the system
must recover from the deadlock.
The most common solution is to rollback the transaction to break the
deadlock.The following three actions should be taken:
1.Selection Of Victim
Given a set of deadlocked transactions,we should determine which
transaction to rollback to break the deadlock.
Following should be kept in mind for determining the roll back of
transaction
a)How many data items the transaction has used?
b)How many more data items the transaction needs for it to complete?
c)How many transactions will be involved in rollback?
b)Rollback
●
●
●
Once we have decided that a particular transaction must be rolled back,we
must determine how far this transaction should be rolled back.
The simplest solution is total roll back.Abort the transaction and restart it.
However it is efficient to roll back the transaction to break the deadlock.
●
The deadlock detection mechanism should decide which locks the selected
transaction needs to release in order to break the deadlock.
●
●
●
c)Starvation
In a system where the selection of victims is based primarily on cost factors.
It may happen that the same transaction is always picked as a victim.
As a result,the transaction never completes its designated task,thus there is a
transaction.
We must be ensure that a particular transaction is rolled back for finite
times.
Deadlock dbms

More Related Content

PPT
Taxonomy for bugs
PPTX
PRECISION FARMING
PPTX
Role of information technology in Agriculture
PPT
15. Transactions in DBMS
PPTX
Hand gesture recognition PROJECT PPT.pptx
PPTX
V model presentation
PPTX
Quality management ppt
PPT
16. Concurrency Control in DBMS
Taxonomy for bugs
PRECISION FARMING
Role of information technology in Agriculture
15. Transactions in DBMS
Hand gesture recognition PROJECT PPT.pptx
V model presentation
Quality management ppt
16. Concurrency Control in DBMS

What's hot (20)

PPTX
Deadlock in database
PPTX
Transaction management DBMS
PPTX
Distributed database management system
PPTX
Lock based protocols
PPT
Thrashing allocation frames.43
PPTX
Concurrency Control in Database Management System
PPTX
Acid properties
DOC
Time and space complexity
PPTX
Concurrency Control in Distributed Database.
PPTX
Database recovery
PPTX
serializability in dbms
PPTX
database recovery techniques
PPTX
Deadlock Avoidance in Operating System
PPTX
8 queens problem using back tracking
PDF
Semaphores
PPTX
Memory Management in OS
PPTX
PPT
Deadlock detection and recovery by saad symbian
PPTX
Doubly Linked List
PPTX
Graph coloring using backtracking
Deadlock in database
Transaction management DBMS
Distributed database management system
Lock based protocols
Thrashing allocation frames.43
Concurrency Control in Database Management System
Acid properties
Time and space complexity
Concurrency Control in Distributed Database.
Database recovery
serializability in dbms
database recovery techniques
Deadlock Avoidance in Operating System
8 queens problem using back tracking
Semaphores
Memory Management in OS
Deadlock detection and recovery by saad symbian
Doubly Linked List
Graph coloring using backtracking
Ad

Similar to Deadlock dbms (20)

PPTX
deadlock handling
PPTX
Transaction Management - Deadlock Handling
PPT
Deadlock management
PPTX
PPT
Lecture 5 Deadlocks in Database Systems.ppt
PDF
Concurrency Control, Recovery, Case Studies
PPTX
DBMS Session 6 Transactions Management and Concurrency Control.pptx
PDF
Unit 3 part 2(DEADLOCK)
PPTX
Deadlocks and Deadlock Detection Other Issues
PPTX
DistributedDeadlock on distriburtedNetwork.pptx
PPS
Deadlock
PPTX
Concurrency control
PPTX
Concurrency Control & Deadlock Handling
PPTX
Deadlock Slides
PDF
PPT-concurrency Control database management system DBMS concurrent control (U...
PDF
Design & Development of an Advanced Database Management System Using Multiver...
deadlock handling
Transaction Management - Deadlock Handling
Deadlock management
Lecture 5 Deadlocks in Database Systems.ppt
Concurrency Control, Recovery, Case Studies
DBMS Session 6 Transactions Management and Concurrency Control.pptx
Unit 3 part 2(DEADLOCK)
Deadlocks and Deadlock Detection Other Issues
DistributedDeadlock on distriburtedNetwork.pptx
Deadlock
Concurrency control
Concurrency Control & Deadlock Handling
Deadlock Slides
PPT-concurrency Control database management system DBMS concurrent control (U...
Design & Development of an Advanced Database Management System Using Multiver...
Ad

Recently uploaded (20)

PPTX
Geodesy 1.pptx...............................................
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
web development for engineering and engineering
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Digital Logic Computer Design lecture notes
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Geodesy 1.pptx...............................................
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
web development for engineering and engineering
Operating System & Kernel Study Guide-1 - converted.pdf
Strings in CPP - Strings in C++ are sequences of characters used to store and...
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Model Code of Practice - Construction Work - 21102022 .pdf
UNIT 4 Total Quality Management .pptx
Digital Logic Computer Design lecture notes
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
OOP with Java - Java Introduction (Basics)
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Internet of Things (IOT) - A guide to understanding
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Foundation to blockchain - A guide to Blockchain Tech
UNIT-1 - COAL BASED THERMAL POWER PLANTS
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...

Deadlock dbms

  • 1. Prepared by- Name : Vardhil Patel Guided by: Prof. _____________ Gandhinagar Institute of Technology Subject: DBMS Deadlock
  • 2. Contents 1. What is Deadlock? 2. Deadlock Prevention 3. Deadlock Detection 4. Recovery of Deadlock
  • 3. What is Deadlock?    A system is in a deadlock state if there exists a set of transactions such that every transaction in the set is waiting for another transaction in the set. None of the transaction can make progress in such a situation. The only remedy to this undesirable condition is for system to invoke some drastic action,such as rolling back some of the transactions involved in the deadlock.  There are two methods for dealing with deadlock 1.Deadlock Prevention. 2.Deadlock detection & Recovery.
  • 4. Dead Lock Prevention ● ● ● ● ● There are two approaches to deadlock prevention. One approach ensures that no cyclic waits can occur by ordering the requests for locks. Second Approach is the rollback of transaction. The simplest scheme under the first approach requires that each transaction locks all its data before execution. Moreover,either all are locked or none. ● Another Approach for preventing deadlocks is to impose an ordering of all data items,and to require that transaction lock data items in sequence.
  • 5. Preemption-Prevention to Deadlock ● ● ● The second approach for prevention of deadlock is preemption and transaction rollback. In preemption when a transaction,when a transaction T2 requests a lock that transaction T1 holds,the lock granted to T1 may be preempted by rolling back of T1 and granting of lock to T2. Two different deadlock prevention Technique using Timestamps 1.Wait-Die Scheme When a tranasaction Ti requests a data item currently held by Tj ,Ti is allowed to wait only if it has a timestamp smaller than Tj.Otherwise Ti is rolled back. 2.Wound-Wait Scheme When transaction Ti requests a data item currently held by Tj ,Ti is allowed to wait only if it has timestamp larger than that of Tj. Otherwise Tj is rolled back.
  • 6. Dead Lock Detection ● ● Deadlocks can be described precisely in terms of a directed Graph called wait-for Graph. Wait-for Graphwith no cycle Wait-for Graph with Cycle T26 T25 T27 T28 T25 T26 T27 T28
  • 7. Recovery From Deadlock ● ● ● When a detection algorithm determines that a dead lock exist,the system must recover from the deadlock. The most common solution is to rollback the transaction to break the deadlock.The following three actions should be taken: 1.Selection Of Victim Given a set of deadlocked transactions,we should determine which transaction to rollback to break the deadlock. Following should be kept in mind for determining the roll back of transaction a)How many data items the transaction has used? b)How many more data items the transaction needs for it to complete? c)How many transactions will be involved in rollback?
  • 8. b)Rollback ● ● ● Once we have decided that a particular transaction must be rolled back,we must determine how far this transaction should be rolled back. The simplest solution is total roll back.Abort the transaction and restart it. However it is efficient to roll back the transaction to break the deadlock. ● The deadlock detection mechanism should decide which locks the selected transaction needs to release in order to break the deadlock. ● ● ● c)Starvation In a system where the selection of victims is based primarily on cost factors. It may happen that the same transaction is always picked as a victim. As a result,the transaction never completes its designated task,thus there is a transaction. We must be ensure that a particular transaction is rolled back for finite times.