DBMS Notes
This unit addresses two fundamental challenges in database systems — ensuring that database operations complete reliably even when failures occur, and ensuring that multi
Unit Overview
This unit addresses two fundamental challenges in database systems — ensuring that database operations complete reliably even when failures occur, and ensuring that multiple users can access the database simultaneously without corrupting data. These problems are collectively solved through transaction management, concurrency control protocols, and recovery mechanisms.
In any real-world database system, multiple users execute operations concurrently. A banking system processes thousands of transfers per second, an airline reservation system handles simultaneous bookings, and an e-commerce platform updates inventory while multiple customers checkout. Without proper transaction management and concurrency control, these systems would produce incorrect results — money could disappear, seats could be double-booked, and inventory counts could become negative.
Topics Covered in This Unit
| Topic | Description | Key Concepts |
|---|---|---|
| Transaction Management | Logical unit of database work | Begin, commit, abort, ACID properties |
| Transaction States | Lifecycle stages of a transaction | Active, partially committed, committed, failed, aborted |
| ACID Properties | Guarantees for reliable transactions | Atomicity, consistency, isolation, durability |
| Concurrency Control | Managing simultaneous data access | Schedules, conflicts, serializability |
| Serializability | Correctness criterion for concurrent schedules | Conflict serializability, view serializability, precedence graph |
| Lock-Based Protocols | Using locks to control data access | Shared locks, exclusive locks, lock compatibility |
| Two-Phase Locking | Protocol guaranteeing serializability | Growing phase, shrinking phase, lock point |
| Timestamp-Based Protocol | Using timestamps for ordering decisions | Read/write timestamps, Thomas write rule |
| Deadlock in DBMS | Circular waiting among transactions | Wait-for graph, detection, prevention, victim selection |
| Recovery System | Restoring database after failures | Transaction failure, system crash, disk failure |
| Log-Based Recovery | Using write-ahead logs for recovery | Undo, redo, undo-redo logging, WAL protocol |
| Checkpoints | Reducing recovery work after crashes | Consistent checkpoints, fuzzy checkpoints |
| Shadow Paging | Recovery without log-based approach | Current page table, shadow page table, commit operation |
The Concurrency Problem Illustrated
| t1 READ(A) | 1000 1000 |
| t2 READ(A) | 1000 1000 |
| Expected final balance | 1000 - 500 - 300 = 200 |
| Actual final balance | 700 (T1's update is LOST) |
This example demonstrates why uncontrolled concurrency is dangerous. The solution requires either locking A during each transaction or using timestamps to detect and resolve conflicts.
How Topics Build on Each Other
The unit follows a logical progression. Transaction management introduces the concept of transactions and their properties. Transaction states describe the lifecycle. ACID properties define what guarantees a correct transaction system must provide.
Concurrency control then addresses how to achieve isolation when multiple transactions run simultaneously. Serializability provides the theoretical correctness criterion. Lock-based protocols and two-phase locking offer one approach to achieving serializability. Timestamp protocols provide an alternative lock-free approach. Deadlocks are a side effect of locking that must be handled.
Recovery mechanisms ensure durability and atomicity — if the system crashes, log-based recovery and checkpoints restore the database to a consistent state. Shadow paging offers a completely different recovery approach without logs.
Learning Objectives
After completing this unit, you should be able to:
- Define transactions and explain all four ACID properties with practical examples
- Identify concurrency problems — dirty reads, lost updates, non-repeatable reads, and phantom reads
- Test whether a schedule is conflict-serializable using precedence graphs
- Apply two-phase locking protocol and identify its variants
- Execute the timestamp-based protocol and apply Thomas's write rule
- Detect deadlocks using wait-for graphs and apply prevention strategies
- Perform log-based recovery using undo, redo, and undo-redo algorithms
- Explain checkpoint mechanisms and shadow paging recovery
These concepts are essential for database administrators, backend developers, and anyone working with systems that require data integrity under concurrent access.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Unit 4 — Transaction Management & Concurrency Control.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Database Management Systems (DBMS) topic.
Search Terms
dbms, database management systems (dbms), unit, unit 4 — transaction management & concurrency control
Related Database Management Systems (DBMS) Topics