Deadlock handling in DBMS

December 4, 2026 · Team EasyExamNotes · 2 min read (est.) · 0 comments

Share on WhatsApp

← RGPV CS-502 DBMS December 2020 solved question paper

CS-502 (CBGS) | December 2020 | Q2(a) | 7 marks

Question (restated): Discuss deadlock management and resolution.

Answer

A deadlock occurs when transactions wait indefinitely for resources held by one another. Suppose T1 holds an exclusive lock on A and requests B, while T2 holds B and requests A. Neither can proceed. The four necessary conditions are mutual exclusion, hold and wait, no preemption and circular wait.

Prevention eliminates a necessary condition. A fixed global lock acquisition order prevents circular wait. Conservative locking requests all required locks before execution, reducing hold and wait but limiting concurrency. Timestamp schemes such as wait-die and wound-wait restrict waiting directions: in wait-die an older requester may wait for a younger holder, while a younger requester aborts; in wound-wait an older requester aborts a younger holder, while a younger requester waits.

Detection allows waits and periodically constructs a wait-for graph. A directed edge Ti → Tj means Ti is waiting for a lock held by Tj. A cycle indicates deadlock in the usual database lock model. A timeout is simpler but may abort transactions that are merely slow.

Recovery selects a victim using criteria such as work completed, locks held and rollback cost. The system rolls back the victim, releases its locks and allows other transactions to proceed. The victim may restart later. Repeatedly choosing the same victim causes starvation, so age or rollback count should influence selection.

Deadlock is distinct from starvation: starvation can occur without a cycle when a transaction is repeatedly denied a resource. A practical DBMS combines detection or prevention with fair scheduling and transaction rollback.

Deadlock handling in DBMS
Deadlock handling in DBMS — conceptual illustration

Further reading: Silberschatz, Korth and Sudarshan, Database System Concepts.

← RGPV CS-502 DBMS December 2020 solved question paper

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion