SlideShare uma empresa Scribd logo
1 de 9
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

Mais conteúdo relacionado

Mais procurados

Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
Ravindra Raju Kolahalam
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMS
koolkampus
 

Mais procurados (20)

Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocols
 
System calls
System callsSystem calls
System calls
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
 
Database System Architectures
Database System ArchitecturesDatabase System Architectures
Database System Architectures
 
Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handling
 
Stack organization
Stack organizationStack organization
Stack organization
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock in database
Deadlock in databaseDeadlock in database
Deadlock in database
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMS
 
Transaction management in DBMS
Transaction management in DBMSTransaction management in DBMS
Transaction management in DBMS
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 
And or graph
And or graphAnd or graph
And or graph
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 
Crash recovery in database
Crash recovery in databaseCrash recovery in database
Crash recovery in database
 

Semelhante a Deadlock dbms

Semelhante a Deadlock dbms (20)

Transaction Management - Deadlock Handling
Transaction Management - Deadlock HandlingTransaction Management - Deadlock Handling
Transaction Management - Deadlock Handling
 
Deadlock management
Deadlock managementDeadlock management
Deadlock management
 
deadlock
deadlockdeadlock
deadlock
 
Concurrency Control, Recovery, Case Studies
Concurrency Control, Recovery, Case StudiesConcurrency Control, Recovery, Case Studies
Concurrency Control, Recovery, Case Studies
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock
DeadlockDeadlock
Deadlock
 
Rdbms
RdbmsRdbms
Rdbms
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Rdbms
RdbmsRdbms
Rdbms
 
Rdbms
RdbmsRdbms
Rdbms
 
Concurrency Control & Deadlock Handling
Concurrency Control & Deadlock HandlingConcurrency Control & Deadlock Handling
Concurrency Control & Deadlock Handling
 
Deadlock Slides
Deadlock SlidesDeadlock Slides
Deadlock Slides
 
F017213747
F017213747F017213747
F017213747
 
F017213747
F017213747F017213747
F017213747
 
Design & Development of an Advanced Database Management System Using Multiver...
Design & Development of an Advanced Database Management System Using Multiver...Design & Development of an Advanced Database Management System Using Multiver...
Design & Development of an Advanced Database Management System Using Multiver...
 
Deadlock Detection
Deadlock DetectionDeadlock Detection
Deadlock Detection
 
Unit iv: Deadlocks
Unit iv: DeadlocksUnit iv: Deadlocks
Unit iv: Deadlocks
 
operating system
operating systemoperating system
operating system
 
operating system
operating systemoperating system
operating system
 

Último

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Último (20)

Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 

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.