SlideShare a Scribd company logo
Submitted by,
M. Kavitha,
M. Sc(CS&IT),
Nadar Saraswathi college of Arts & Science,
Vadapudupatti, Theni.
A system is deadlocked if there is a set of
transactions such that every transaction in the set
is waiting for another transaction in the set.
There are two type of deadlock handling.
1. Deadlock Prevention.
2. Timeout – Based Schemes.
3. Deadlock Detection and Recovery.
3.1. Deadlock Detection.
3.2. Recovery from Deadlock
Deadlock prevention protocols ensure that
the system will never enter into a deadlock state.
Some prevention strategies :
› Require that each transaction locks all its data
items before it begins execution (pre-declaration).
› Impose partial ordering of all data items and
require that a transaction can lock data items only
in the order specified by the partial order (graph-
based protocol).
A schemes use transaction timestamps for the
sake of deadlock prevention alone.
wait-die scheme — non-preemptive
› older transaction may wait for younger one to
release data item. Younger transactions never wait
for older ones they are rolled back instead.
› a transaction may die several times before
acquiring needed data item
wound-wait scheme — preemptive
› older transaction wounds (forces rollback) of
younger transaction instead of waiting for it.
Younger transactions may wait for older ones.
› It may be fewer rollbacks than wait-die scheme.
Both in wait-die and in wound-wait
schemes, a rolled back transactions is restarted
with its original timestamp. Older transactions
thus have precedence over newer ones, and
starvation is hence avoided.
* A transaction waits for a lock only for a
specified amount of time. The wait times out and
the transaction is rolled back, thus deadlocks are
not possible.
* Simple to implement but starvation is
possible. Also difficult to determine good value
of the timeout interval.
The timeout scheme is particularly easy to
implement and works well if transactions are
short and if long waits are to deadlocks.
A System does not employ some protocol that
ensures deadlock freedom, then a detection and
recovery scheme.
* Maintain information about the current
allocation of data items to transactions, as well as
any outstanding data item request.
* Provide an algorithm that uses this
information to determine whether the system has
entered a deadlock state.
* Recover from the deadlock when the
detection algorithm determine that a deadlock exists.
Deadlocks can be described as a wait-for graph,
which consists of a pair G = (V,E),
› V is a set of vertices (all the transactions in the
system)
› E is a set of edges; each element is an ordered pair
Ti Tj.
If Ti  Tj is in E, then there is a directed edge
from Ti to Tj, implying that Ti is waiting for Tj to
release a data item.
When Ti requests a data item currently being
held by Tj, then the edge Ti Tj is inserted in the
wait-for graph. This edge is removed only when Tj
is no longer holding a data item needed by Ti.
The system is in a deadlock state if and only if
the wait-for graph has a cycle.
Must invoke a deadlock-detection algorithm
periodically to look for cycles.
T26 T28 T27 T26
Fig 1 : Wait-for graph without a cycle Fig 2 : Wait-for graph with a cycle
Deadlock Detection
A detection algorithm determines that a
deadlock exists, the system must recover from the
deadlock.
Deadlock is detected :
› Selection of a victim -- Some transaction will
have to rolled back (made a victim) to break
deadlock. Select that transaction as victim that
will incur minimum cost.
› Rollback -- determine how far to roll back
transaction.
 Total rollback: Abort the transaction and then
restart it.
 More effective to roll back transaction only as
far as necessary to break deadlock.
› Starvation -- happens if same transaction is
always chosen as victim. Include the number of
rollbacks in the cost factor to avoid starvation
Thank You

More Related Content

What's hot

Operating system - Deadlock
Operating system - DeadlockOperating system - Deadlock
Operating system - Deadlock
Shashank Yenurkar
 
Apriori Algorithm
Apriori AlgorithmApriori Algorithm
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency ControlAli Usman
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocols
ChethanMp7
 
Locking base concurrency control
  Locking base concurrency control  Locking base concurrency control
Locking base concurrency control
Prakash Poudel
 
deadlock
deadlockdeadlock
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency control
balamurugan.k Kalibalamurugan
 
Recovery Techniques and Need of Recovery
Recovery Techniques and   Need of RecoveryRecovery Techniques and   Need of Recovery
Recovery Techniques and Need of Recovery
Pooja Dixit
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
Raj vardhan
 
Concurrency control
Concurrency  controlConcurrency  control
Concurrency control
Javed Khan
 
Deadlock dbms
Deadlock dbmsDeadlock dbms
Deadlock dbms
Vardhil Patel
 
Concurrency Conrol
Concurrency ConrolConcurrency Conrol
Concurrency Conrol
lubna19
 
Concurrency control PPT
Concurrency control PPTConcurrency control PPT
Concurrency control PPT
ShushrutGupta
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
Janagi Raman S
 
Concurrency Control.
Concurrency Control.Concurrency Control.
Process Synchronization And Deadlocks
Process Synchronization And DeadlocksProcess Synchronization And Deadlocks
Process Synchronization And Deadlockstech2click
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating system
Ali Haider
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
Saranya Natarajan
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
Ashish K
 

What's hot (20)

Operating system - Deadlock
Operating system - DeadlockOperating system - Deadlock
Operating system - Deadlock
 
Apriori Algorithm
Apriori AlgorithmApriori Algorithm
Apriori Algorithm
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency Control
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocols
 
Locking base concurrency control
  Locking base concurrency control  Locking base concurrency control
Locking base concurrency control
 
deadlock
deadlockdeadlock
deadlock
 
Distributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency controlDistributed datababase Transaction and concurrency control
Distributed datababase Transaction and concurrency control
 
Recovery Techniques and Need of Recovery
Recovery Techniques and   Need of RecoveryRecovery Techniques and   Need of Recovery
Recovery Techniques and Need of Recovery
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
 
Concurrency control
Concurrency  controlConcurrency  control
Concurrency control
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock dbms
Deadlock dbmsDeadlock dbms
Deadlock dbms
 
Concurrency Conrol
Concurrency ConrolConcurrency Conrol
Concurrency Conrol
 
Concurrency control PPT
Concurrency control PPTConcurrency control PPT
Concurrency control PPT
 
DBMS UNIT IV.pptx
DBMS UNIT IV.pptxDBMS UNIT IV.pptx
DBMS UNIT IV.pptx
 
Concurrency Control.
Concurrency Control.Concurrency Control.
Concurrency Control.
 
Process Synchronization And Deadlocks
Process Synchronization And DeadlocksProcess Synchronization And Deadlocks
Process Synchronization And Deadlocks
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating system
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
 

Similar to Transaction Management - Deadlock Handling

Concurrency control
Concurrency controlConcurrency control
Concurrency control
Jaya Jeswani
 
F017213747
F017213747F017213747
F017213747
IOSR Journals
 
F017213747
F017213747F017213747
F017213747
IOSR Journals
 
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...
IOSR Journals
 
Concurrency Control & Deadlock Handling
Concurrency Control & Deadlock HandlingConcurrency Control & Deadlock Handling
Concurrency Control & Deadlock Handling
Meghaj Mallick
 
Concurrency Control, Recovery, Case Studies
Concurrency Control, Recovery, Case StudiesConcurrency Control, Recovery, Case Studies
Concurrency Control, Recovery, Case Studies
Prabu U
 
Adbms 42 deadlocks and starvation
Adbms 42 deadlocks and starvationAdbms 42 deadlocks and starvation
Adbms 42 deadlocks and starvation
Vaibhav Khanna
 
Deadlock management
Deadlock managementDeadlock management
Deadlock management
Ahmed kasim
 
Deadlock Detection
Deadlock DetectionDeadlock Detection
Deadlock Detection
Stuart Joy
 
concurrencycontrol from power pint pdf a
concurrencycontrol  from power pint pdf aconcurrencycontrol  from power pint pdf a
concurrencycontrol from power pint pdf a
MdAyanParwez
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
Soumyajit Dutta
 
Concurrency control
Concurrency control Concurrency control
Concurrency control
Abdelrahman Almassry
 
Rdbms
RdbmsRdbms
Rdbms
RdbmsRdbms
Concurrency note.pdf
Concurrency note.pdfConcurrency note.pdf
Concurrency note.pdf
BijayNag1
 
Unit iv: Deadlocks
Unit iv: DeadlocksUnit iv: Deadlocks
Unit iv: Deadlocks
Arnav Chowdhury
 
DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)
Gaurav Solanki
 
VALIDATION BASED PROTOCOL AND MULTIPLE GRANULARITY.pptx
VALIDATION BASED PROTOCOL AND MULTIPLE GRANULARITY.pptxVALIDATION BASED PROTOCOL AND MULTIPLE GRANULARITY.pptx
VALIDATION BASED PROTOCOL AND MULTIPLE GRANULARITY.pptx
SamyakJain710491
 
Unit 5 rdbms study_material
Unit 5  rdbms study_materialUnit 5  rdbms study_material
Unit 5 rdbms study_material
gayaramesh
 
Improved Deadlock Prevention Algorithms in Distributed Systems
Improved Deadlock Prevention Algorithms in Distributed SystemsImproved Deadlock Prevention Algorithms in Distributed Systems
Improved Deadlock Prevention Algorithms in Distributed Systems
IJEACS
 

Similar to Transaction Management - Deadlock Handling (20)

Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
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...
 
Concurrency Control & Deadlock Handling
Concurrency Control & Deadlock HandlingConcurrency Control & Deadlock Handling
Concurrency Control & Deadlock Handling
 
Concurrency Control, Recovery, Case Studies
Concurrency Control, Recovery, Case StudiesConcurrency Control, Recovery, Case Studies
Concurrency Control, Recovery, Case Studies
 
Adbms 42 deadlocks and starvation
Adbms 42 deadlocks and starvationAdbms 42 deadlocks and starvation
Adbms 42 deadlocks and starvation
 
Deadlock management
Deadlock managementDeadlock management
Deadlock management
 
Deadlock Detection
Deadlock DetectionDeadlock Detection
Deadlock Detection
 
concurrencycontrol from power pint pdf a
concurrencycontrol  from power pint pdf aconcurrencycontrol  from power pint pdf a
concurrencycontrol from power pint pdf a
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Concurrency control
Concurrency control Concurrency control
Concurrency control
 
Rdbms
RdbmsRdbms
Rdbms
 
Rdbms
RdbmsRdbms
Rdbms
 
Concurrency note.pdf
Concurrency note.pdfConcurrency note.pdf
Concurrency note.pdf
 
Unit iv: Deadlocks
Unit iv: DeadlocksUnit iv: Deadlocks
Unit iv: Deadlocks
 
DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)
 
VALIDATION BASED PROTOCOL AND MULTIPLE GRANULARITY.pptx
VALIDATION BASED PROTOCOL AND MULTIPLE GRANULARITY.pptxVALIDATION BASED PROTOCOL AND MULTIPLE GRANULARITY.pptx
VALIDATION BASED PROTOCOL AND MULTIPLE GRANULARITY.pptx
 
Unit 5 rdbms study_material
Unit 5  rdbms study_materialUnit 5  rdbms study_material
Unit 5 rdbms study_material
 
Improved Deadlock Prevention Algorithms in Distributed Systems
Improved Deadlock Prevention Algorithms in Distributed SystemsImproved Deadlock Prevention Algorithms in Distributed Systems
Improved Deadlock Prevention Algorithms in Distributed Systems
 

More from kavitha muneeshwaran

Physical Security
Physical SecurityPhysical Security
Physical Security
kavitha muneeshwaran
 
Digital Audio
Digital AudioDigital Audio
Digital Audio
kavitha muneeshwaran
 
Data structure
Data structureData structure
Data structure
kavitha muneeshwaran
 
Internet Programming with Java
Internet Programming with JavaInternet Programming with Java
Internet Programming with Java
kavitha muneeshwaran
 
Digital image processing
Digital image processing  Digital image processing
Digital image processing
kavitha muneeshwaran
 
Staffing level estimation
Staffing level estimation Staffing level estimation
Staffing level estimation
kavitha muneeshwaran
 
Data Integration and Transformation in Data mining
Data Integration and Transformation in Data miningData Integration and Transformation in Data mining
Data Integration and Transformation in Data mining
kavitha muneeshwaran
 
Process
ProcessProcess
Digital Logic circuit
Digital Logic circuitDigital Logic circuit
Digital Logic circuit
kavitha muneeshwaran
 
C and C++ functions
C and C++ functionsC and C++ functions
C and C++ functions
kavitha muneeshwaran
 
I/O system in intel 80386 microcomputer architecture
I/O system in intel 80386 microcomputer architectureI/O system in intel 80386 microcomputer architecture
I/O system in intel 80386 microcomputer architecture
kavitha muneeshwaran
 
narrow Band ISDN
narrow Band ISDNnarrow Band ISDN
narrow Band ISDN
kavitha muneeshwaran
 

More from kavitha muneeshwaran (13)

Physical Security
Physical SecurityPhysical Security
Physical Security
 
Digital Audio
Digital AudioDigital Audio
Digital Audio
 
Java
JavaJava
Java
 
Data structure
Data structureData structure
Data structure
 
Internet Programming with Java
Internet Programming with JavaInternet Programming with Java
Internet Programming with Java
 
Digital image processing
Digital image processing  Digital image processing
Digital image processing
 
Staffing level estimation
Staffing level estimation Staffing level estimation
Staffing level estimation
 
Data Integration and Transformation in Data mining
Data Integration and Transformation in Data miningData Integration and Transformation in Data mining
Data Integration and Transformation in Data mining
 
Process
ProcessProcess
Process
 
Digital Logic circuit
Digital Logic circuitDigital Logic circuit
Digital Logic circuit
 
C and C++ functions
C and C++ functionsC and C++ functions
C and C++ functions
 
I/O system in intel 80386 microcomputer architecture
I/O system in intel 80386 microcomputer architectureI/O system in intel 80386 microcomputer architecture
I/O system in intel 80386 microcomputer architecture
 
narrow Band ISDN
narrow Band ISDNnarrow Band ISDN
narrow Band ISDN
 

Recently uploaded

Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 

Recently uploaded (20)

Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 

Transaction Management - Deadlock Handling

  • 1. Submitted by, M. Kavitha, M. Sc(CS&IT), Nadar Saraswathi college of Arts & Science, Vadapudupatti, Theni.
  • 2. A system is deadlocked if there is a set of transactions such that every transaction in the set is waiting for another transaction in the set. There are two type of deadlock handling. 1. Deadlock Prevention. 2. Timeout – Based Schemes. 3. Deadlock Detection and Recovery. 3.1. Deadlock Detection. 3.2. Recovery from Deadlock
  • 3. Deadlock prevention protocols ensure that the system will never enter into a deadlock state. Some prevention strategies : › Require that each transaction locks all its data items before it begins execution (pre-declaration). › Impose partial ordering of all data items and require that a transaction can lock data items only in the order specified by the partial order (graph- based protocol).
  • 4. A schemes use transaction timestamps for the sake of deadlock prevention alone. wait-die scheme — non-preemptive › older transaction may wait for younger one to release data item. Younger transactions never wait for older ones they are rolled back instead. › a transaction may die several times before acquiring needed data item
  • 5. wound-wait scheme — preemptive › older transaction wounds (forces rollback) of younger transaction instead of waiting for it. Younger transactions may wait for older ones. › It may be fewer rollbacks than wait-die scheme. Both in wait-die and in wound-wait schemes, a rolled back transactions is restarted with its original timestamp. Older transactions thus have precedence over newer ones, and starvation is hence avoided.
  • 6. * A transaction waits for a lock only for a specified amount of time. The wait times out and the transaction is rolled back, thus deadlocks are not possible. * Simple to implement but starvation is possible. Also difficult to determine good value of the timeout interval. The timeout scheme is particularly easy to implement and works well if transactions are short and if long waits are to deadlocks.
  • 7. A System does not employ some protocol that ensures deadlock freedom, then a detection and recovery scheme. * Maintain information about the current allocation of data items to transactions, as well as any outstanding data item request. * Provide an algorithm that uses this information to determine whether the system has entered a deadlock state. * Recover from the deadlock when the detection algorithm determine that a deadlock exists.
  • 8. Deadlocks can be described as a wait-for graph, which consists of a pair G = (V,E), › V is a set of vertices (all the transactions in the system) › E is a set of edges; each element is an ordered pair Ti Tj. If Ti  Tj is in E, then there is a directed edge from Ti to Tj, implying that Ti is waiting for Tj to release a data item.
  • 9. When Ti requests a data item currently being held by Tj, then the edge Ti Tj is inserted in the wait-for graph. This edge is removed only when Tj is no longer holding a data item needed by Ti. The system is in a deadlock state if and only if the wait-for graph has a cycle. Must invoke a deadlock-detection algorithm periodically to look for cycles. T26 T28 T27 T26
  • 10. Fig 1 : Wait-for graph without a cycle Fig 2 : Wait-for graph with a cycle Deadlock Detection
  • 11. A detection algorithm determines that a deadlock exists, the system must recover from the deadlock. Deadlock is detected : › Selection of a victim -- Some transaction will have to rolled back (made a victim) to break deadlock. Select that transaction as victim that will incur minimum cost. › Rollback -- determine how far to roll back transaction.
  • 12.  Total rollback: Abort the transaction and then restart it.  More effective to roll back transaction only as far as necessary to break deadlock. › Starvation -- happens if same transaction is always chosen as victim. Include the number of rollbacks in the cost factor to avoid starvation