

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


In a multi-user database environment, concurrency control is essential to ensure data integrity and consistency. This guide explores how DBMS manages simultaneous transactions to prevent data anomalies.
A lock is a synchronization mechanism used to limit access to a data item when multiple transactions are active.
Shared (S) Lock: Also known as a "Read Lock." Multiple transactions can hold a shared lock on the same item. It allows reading but prevents updates. Exclusive (X) Lock: Also known as a "Write Lock." Only one transaction can hold an exclusive lock. No other transaction can read or write until it is released.
To ensure Serializability , DBMS often follows the 2PL protocol:
Growing Phase: Transaction acquires locks but cannot release any. Shrinking Phase: Transaction releases locks but cannot acquire new ones.
A Deadlock occurs when two or more transactions are stuck in a circular wait, each holding a resource the other needs.
Wait-For Graph (WFG) Visualization
Locking Mechanisms & Deadlock Resolution Strategies
A cycle in the Wait-For Graph (WFG) indicates a Deadlock state.
3. Deadlock Handling Strategies
Strategy Mechanism Pros / Cons
Prevention Wait-Die or Wound-Wait using timestamps.
Prevents deadlocks entirely but can lead to unnecessary rollbacks.
Avoidance Dynamic analysis of resource allocation (Banker's Algorithm).
Theoretically sound; overhead is too high for modern high-speed DBMS.
Detection Periodic WFG analysis to find cycles.
Allows high concurrency; requires a "Victim" rollback if deadlock is found.
Deadlock Prevention via Timestamps:
Wait-Die: If TS(T_i) < TS(T_j) , T_i waits; else T_i dies. Wound-Wait: If TS(T_i) < TS(T_j) , T_i wounds T_j ; else T_i waits.
4. Academic References
Silberschatz, A., Korth, H. F., & Sudarshan, S. Database System Concepts. McGraw- Hill. Elmasri, R., & Navathe, S. B. Fundamentals of Database Systems. Pearson.
Waits for Item Y
Waits for Item X