DBMS Deadlock
DBMS Deadlock
Deadlock
Deadlocks
Detection
Wait-for graph
Prevention
Resource ordering
Timeout
Wait-die
Wound-wait
Deadlock Detection
T1
T4
T3
T5
T6
T7
Deadlock Detection
When Ti requests a data item held by Tj, then Ti Tj is inserted in the waitfor 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.
The system invokes a deadlock-detection algorithm periodically to look for
cycles.
Deadlock Recovery
Deadlock Handling
Deadlock Handling
T1
lock-X on X
write (X)
write(X)
T2
lock-X on Y
write (Y)
wait for lock-X on X
write(X)
Deadlock in DBMSs
What is a deadlock?
Programmers
Consistency:
DB
Concurrency
starts in a consistent state, it ends in a
Control
consistent state.
System
Recovery Isolation:
System
Durability:
persist.