IT405 Unit 4
IT405 • Database Management System

DBMS Unit 4 Notes

Transactions, Serializability, Concurrency Control and Recovery

Complete RGPV IT405 Database Management System Unit 4 notes for B.Tech students. This unit covers Transaction Processing, ACID Properties, Transaction States, Schedules, Serializability, Conflict Serializability, View Serializability, Concurrency Control, Lock Based Protocols, Two Phase Locking, Deadlock, Recovery Techniques, Log Based Recovery and Checkpoints in easy exam-oriented Hinglish language with important questions and PYQ analysis.

📘

Detailed Notes

Read complete DBMS Unit 4 notes covering transactions, ACID properties, schedules, serializability, concurrency control, deadlock and recovery techniques with simple explanations.

Read Notes

Important Questions

Prepare expected 7 marks and 14 marks questions from Transaction Processing, ACID Properties, Serializability, 2PL, Deadlock and Recovery.

View Questions
📄

PYQ Analysis

Check RGPV PYQ trends from uploaded papers with most repeated questions and 2026 prediction for DBMS Unit 4.

Open Analysis

DBMS Unit 4 Syllabus Topics

Transaction Processing ACID Properties Transaction States Schedules Serializability Conflict Serializability View Serializability Concurrency Control Lock Based Protocols Two Phase Locking Deadlock Recovery Techniques Log Based Recovery Checkpoints Important Questions PYQ Analysis FAQs

What You Will Learn in DBMS Unit 4?

DBMS Unit 4 database transactions ka core concept explain karta hai. Is unit me hum samajhte hain ki database me multiple users ke operations ko safe, consistent aur reliable tarike se kaise execute kiya jata hai.

RGPV previous year papers me Unit 4 se ACID Properties, Serializability, Concurrency Control, Two Phase Locking, Deadlock aur Recovery Techniques frequently pooche gaye hain.

UNIT 4 ROADMAP ↓ Transaction Processing ↓ ACID Properties ↓ Transaction States ↓ Schedules ↓ Serializability ↓ Concurrency Control ↓ Lock Based Protocols ↓ Two Phase Locking ↓ Deadlock ↓ Recovery Techniques ↓ Log Based Recovery ↓ Checkpoints

Transaction Processing

Transaction Processing DBMS ka ek important concept hai. Database me jo bhi logical operation perform hota hai, jaise data insert, update, delete ya transfer, use transaction ke form me execute kiya jata hai.

Transaction ka main goal hota hai ki database hamesha consistent aur reliable state me rahe.


Definition

A Transaction is a logical unit of work that consists of one or more database operations and changes the database from one consistent state to another consistent state.


Simple Meaning

Transaction ek complete task hota hai. Ya to poora task successfully complete hoga, ya agar error aa jaye to database previous safe state me wapas aa jayega.


Real Life Example: Bank Transfer

Account A ↓ Debit ₹1000 ---------------- Account B ↓ Credit ₹1000

Yahaan debit aur credit dono operations milkar ek single transaction banate hain.

Agar debit ho gaya lekin credit fail ho gaya, to database inconsistent ho jayega. Isliye transaction processing ensure karti hai ki dono operations complete hon ya dono cancel ho jayein.


Operations in Transaction

Transaction │ ├── READ ├── WRITE ├── COMMIT └── ROLLBACK

READ Operation

READ operation database se data read karta hai.

READ(A)

WRITE Operation

WRITE operation database me updated data write karta hai.

WRITE(A)

COMMIT Operation

COMMIT transaction ke changes ko permanently database me save karta hai.

COMMIT;

ROLLBACK Operation

ROLLBACK transaction ke changes ko undo karta hai aur database ko previous consistent state me wapas lata hai.

ROLLBACK;

ACID Properties

ACID properties transaction processing ka foundation hain. Ye ensure karti hain ki database transactions reliable, safe aur consistent tareeke se execute hon.


Definition

ACID properties are a set of properties that guarantee reliable transaction processing in a database system.


ACID Full Form

A = Atomicity C = Consistency I = Isolation D = Durability

1. Atomicity

Atomicity ka matlab hai transaction ya to completely execute hogi ya bilkul execute nahi hogi.

Iska rule hai: All or Nothing.


Example

Transfer ₹1000 ↓ Debit Account A ↓ Credit Account B

Agar credit operation fail ho jaye to debit operation bhi rollback ho jayega.


2. Consistency

Consistency ka matlab hai transaction ke baad database valid aur correct state me hona chahiye.


Example

Agar Account A + Account B ka total balance transaction se pehle ₹50,000 tha, to transfer ke baad bhi total ₹50,000 hi rehna chahiye.

Before Transaction Total = ₹50,000 ---------------- After Transaction Total = ₹50,000

3. Isolation

Isolation ka matlab hai multiple transactions ek saath execute hone par bhi ek dusre ke intermediate results ko affect na karein.


Example

Transaction T1 ↓ Withdraw Money ---------------- Transaction T2 ↓ Check Balance

T2 ko T1 ka incomplete result nahi dikhna chahiye.


4. Durability

Durability ka matlab hai transaction commit hone ke baad changes permanently database me save ho jaate hain.


Example

Agar transaction commit ho gayi aur uske baad power failure ho gaya, tab bhi committed changes lost nahi honge.

COMMIT ↓ Permanent Save ↓ System Failure ↓ Data Safe

ACID Properties Summary Table

Property Meaning
Atomicity All or Nothing
Consistency Valid Database State
Isolation Transactions Execute Independently
Durability Committed Data is Permanent

Why ACID Properties are Important?


Advantages of Transaction Processing


Memory Trick

ACID ↓ A = All or Nothing C = Correct State I = Independent Execution D = Data Permanent

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

Transaction States

Transaction execution ke dauran ek transaction different stages se pass hoti hai. In stages ko Transaction States kaha jata hai.

Transaction States DBMS ko transaction ki current condition aur progress ko track karne me help karti hain.


Definition

Transaction States are the different stages through which a transaction passes during its execution.


Need of Transaction States


Transaction State Diagram

Active ↓ Partially Committed ↓ Committed --------------------- ↓ Failed ↓ Aborted

Types of Transaction States

Transaction States │ ├── Active ├── Partially Committed ├── Committed ├── Failed └── Aborted

1. Active State

Jab transaction execution start karti hai tab wo Active State me hoti hai.

Is state me READ aur WRITE operations perform kiye jaate hain.


Example

BEGIN TRANSACTION ↓ READ(A) ↓ WRITE(A)

2. Partially Committed State

Jab transaction ka last statement execute ho jata hai lekin COMMIT abhi complete nahi hua hota tab transaction Partially Committed State me hoti hai.


Example

READ(A) ↓ WRITE(A) ↓ Last Statement Executed

Agar is stage par system failure ho jaye to transaction rollback ho sakti hai.


3. Committed State

Jab transaction successfully complete ho jati hai aur COMMIT execute ho jata hai tab transaction Committed State me enter karti hai.


Example

READ(A) ↓ WRITE(A) ↓ COMMIT ↓ Committed State

Committed state me database changes permanently save ho jaate hain.


4. Failed State

Agar transaction execution ke dauran error aa jaye to transaction Failed State me chali jaati hai.


Reasons of Failure


Example

READ(A) ↓ WRITE(A) ↓ Power Failure ↓ Failed State

5. Aborted State

Failed transaction ko rollback karke previous consistent state me restore kiya jata hai.

Is stage ko Aborted State kehte hain.


Example

Failed State ↓ ROLLBACK ↓ Aborted State

State Transition Diagram

Active ↓ Partially Committed ↓ Committed ---------------- Active ↓ Failed ↓ Aborted

Transaction Life Cycle

Start ↓ Active ↓ Partially Committed ↓ Committed ↓ End

Failure Case Life Cycle

Start ↓ Active ↓ Failed ↓ Aborted ↓ Restart

Bank Transaction Example

Suppose Account A se ₹5000 transfer karne hain Account B me.

Debit A ↓ Credit B ↓ COMMIT ↓ Success

Agar Credit B ke pehle system fail ho jaye:

Debit A ↓ System Failure ↓ ROLLBACK ↓ Restore Old Data

Advantages of Transaction States


Memory Trick

A ↓ Active ------------------ P ↓ Partially Committed ------------------ C ↓ Committed ------------------ F ↓ Failed ------------------ A ↓ Aborted

Remember: APCFA


Transaction States Summary

State Meaning
Active Transaction Executing
Partially Committed Last Statement Executed
Committed Changes Permanently Saved
Failed Error Occurred
Aborted Rolled Back

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

Schedules

Database me multiple transactions ek saath execute ho sakti hain. In transactions ke operations kis order me execute honge us sequence ko Schedule kaha jata hai.

Schedule transaction execution ka actual order show karta hai aur Concurrency Control ka foundation hai.


Definition

A Schedule is a sequence that indicates the chronological order in which instructions of concurrent transactions are executed.


Need of Schedules


Example Transactions

T1 READ(A) WRITE(A) ---------------- T2 READ(B) WRITE(B)

Types of Schedules

Schedules │ ├── Serial Schedule ├── Non-Serial Schedule └── Concurrent Schedule

1. Serial Schedule

Serial Schedule me ek transaction completely execute hoti hai aur uske baad next transaction start hoti hai.


Example

T1 READ(A) WRITE(A) COMMIT ---------------- T2 READ(B) WRITE(B) COMMIT

Characteristics


Disadvantage

Performance low hoti hai kyunki transactions parallel execute nahi hoti.


2. Non-Serial Schedule

Non-Serial Schedule me multiple transactions ke operations interleaved hote hain.


Example

T1 : READ(A) T2 : READ(B) T1 : WRITE(A) T2 : WRITE(B)

Advantages


Disadvantages


3. Concurrent Schedule

Concurrent Schedule me multiple transactions simultaneously execute hoti hain.


Working

Transaction T1 ↓ Transaction T2 ↓ Transaction T3 ↓ Execute Concurrently

Benefits


Schedule Example

Time T1 T2
1 READ(A)
2 READ(B)
3 WRITE(A)
4 WRITE(B)

Why Serializability is Needed?

Concurrent execution performance increase karti hai, lekin database inconsistency bhi create kar sakti hai.

Is problem ko solve karne ke liye Serializability concept use kiya jata hai.


Serializability

Serializability DBMS ka most important correctness criterion hai.

Ye ensure karta hai ki concurrent schedule ka result kisi serial schedule ke equivalent ho.


Definition

A Schedule is said to be Serializable if its result is equivalent to the result of some Serial Schedule.


Basic Idea

Concurrent Schedule ↓ Check Correctness ↓ Equivalent To ↓ Serial Schedule

Example

Suppose do transactions hain:

T1 READ(A) WRITE(A) ------------------ T2 READ(B) WRITE(B)

Agar concurrent execution ka final result serial execution ke same hai, to schedule serializable hai.


Benefits of Serializability


Schedule Classification

Schedules │ ├── Serializable │ └── Non-Serializable

Serializable Schedule

Concurrent schedule jo serial schedule ke equivalent result produce kare.


Non-Serializable Schedule

Concurrent schedule jo incorrect result produce kare aur serial schedule ke equivalent na ho.


Real Life Example

Banking system me do users same account access kar rahe hain.

User A Withdraw ₹500 ---------------- User B Deposit ₹1000

Serializability ensure karti hai ki final balance correct aaye.


Memory Trick

Serial ↓ One After Another ------------------- Concurrent ↓ Together ------------------- Serializable ↓ Concurrent But Correct

Summary Table

Concept Meaning
Serial Schedule Transactions Execute Sequentially
Non-Serial Schedule Interleaved Execution
Concurrent Schedule Simultaneous Execution
Serializable Schedule Correct Concurrent Execution

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

Conflict Serializability

Conflict Serializability serializability ka sabse common aur practical type hai. Ye check karta hai ki concurrent schedule ko conflict operations swap karke kisi serial schedule me convert kiya ja sakta hai ya nahi.


Definition

A schedule is Conflict Serializable if it can be transformed into a serial schedule by swapping non-conflicting operations.


What is Conflict?

Do operations conflict karte hain agar:


Types of Conflicting Operations

Operation 1 Operation 2 Conflict?
Read(A) Read(A) ❌ No
Read(A) Write(A) ✅ Yes
Write(A) Read(A) ✅ Yes
Write(A) Write(A) ✅ Yes

Non-Conflicting Operations

Read(A) ↓ Read(A) ---------------- Can be Swapped

Conflict Serializable Schedule Example

T1 : Read(A) T1 : Write(A) T2 : Read(B) T2 : Write(B)

Ye schedule easily serial schedule me convert ho sakta hai.

Therefore:

Conflict Serializable ✓

Testing Conflict Serializability

Conflict Serializability check karne ke liye Precedence Graph (Serialization Graph) use kiya jata hai.


Precedence Graph

Graph me:


Rule

Agar graph me cycle nahi hai to schedule Conflict Serializable hai.

Agar graph me cycle hai to schedule Conflict Serializable nahi hai.


Example

T1 → T2

No Cycle

Conflict Serializable ✓

Cycle Example

T1 → T2 ↑ ↓ T4 ← T3

Cycle Present

Not Conflict Serializable ✗

Advantages of Conflict Serializability


View Serializability

View Serializability serializability ka broader concept hai.

Har Conflict Serializable schedule View Serializable hota hai, lekin har View Serializable schedule Conflict Serializable nahi hota.


Definition

A schedule is View Serializable if it produces the same result as a serial schedule from the viewpoint of data read and written.


Conditions for View Equivalence

Do schedules View Equivalent tab honge jab:


Condition 1: Initial Read

Jo transaction initial value read karti hai dono schedules me same honi chahiye.


Condition 2: Read-From Relation

Agar T2 ne T1 ke write ki hui value read ki hai, to dono schedules me same relation hona chahiye.


Condition 3: Final Write

Final value write karne wali transaction dono schedules me same honi chahiye.


View Serializable Example

Schedule S1 ↓ Read(A) Write(A) ------------------- Schedule S2 ↓ Equivalent Final Result

If all three conditions satisfy:

View Serializable ✓

Conflict vs View Serializability

Conflict Serializability View Serializability
Based on Conflicts Based on View Equivalence
Easy to Test Difficult to Test
Uses Precedence Graph No Simple Graph Method
More Restrictive Less Restrictive
Subset of View Serializable Superset

Relationship

Conflict Serializable ⊂ View Serializable

Every Conflict Serializable Schedule is View Serializable.

But every View Serializable Schedule is not Conflict Serializable.


Real Life Example

Bank database me multiple transactions same account access kar rahe hain.

Serializability ensure karti hai ki final balance correct aaye aur data consistency maintain rahe.


Memory Trick

Conflict ↓ Graph ↓ No Cycle ↓ Serializable ------------------- View ↓ Same Result ↓ Serializable

Exam Shortcut

Concept Remember
Conflict Serializable No Cycle in Graph
View Serializable Same Final Result
Conflict Test Easy
View Test Difficult

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

Concurrency Control

Concurrency Control DBMS ka mechanism hai jo multiple transactions ko ek saath execute karte waqt database consistency maintain karta hai.

Modern database systems me kai users same time par database access karte hain. Agar proper control na ho to incorrect results aur data inconsistency generate ho sakti hai.


Definition

Concurrency Control is the process of managing simultaneous execution of transactions so that database consistency and correctness are preserved.


Need of Concurrency Control


Basic Concept

Transaction T1 ↓ Database ↑ Transaction T2 ↓ Concurrency Control ↓ Consistent Result

Advantages of Concurrent Execution


Problems in Concurrent Execution

Concurrency Problems │ ├── Lost Update ├── Dirty Read ├── Uncommitted Dependency ├── Inconsistent Analysis └── Incorrect Summary

1. Lost Update Problem

Lost Update tab hota hai jab do transactions same data item ko update karti hain aur ek transaction ka update overwrite ho jata hai.


Example

Initial Balance = 1000 ------------------- T1 Reads 1000 T2 Reads 1000 ------------------- T1 Adds 500 Balance = 1500 ------------------- T2 Subtracts 200 Balance = 800

Correct balance 1300 hona chahiye tha, lekin T1 ka update lost ho gaya.


Lost Update Result

Expected 1300 ------------------- Actual 800

2. Dirty Read Problem

Dirty Read tab hota hai jab ek transaction dusri transaction ke uncommitted data ko read kar leti hai.


Example

T1 Update Balance 1000 → 2000 (Not Committed) ------------------- T2 Reads Balance = 2000 ------------------- T1 Rollback

T2 ne invalid data read kiya hai.


Dirty Read Result

Read Uncommitted Data ↓ Incorrect Result

3. Uncommitted Dependency

Uncommitted Dependency Dirty Read ka hi advanced form hai.

Ek transaction dusri transaction ke uncommitted changes par depend kar leti hai.


Example

T1 Update Record ↓ T2 Uses Updated Value ↓ T1 Rollback

Ab T2 ka result bhi invalid ho gaya.


4. Inconsistent Analysis Problem

Jab ek transaction data analyze kar rahi hoti hai aur dusri transaction same data update kar deti hai to inconsistent result mil sakta hai.


Example

T1 Calculate Total Balance ------------------- T2 Updates Balance ------------------- T1 Gets Incorrect Total

5. Incorrect Summary Problem

Summary calculations ke dauran concurrent updates incorrect totals generate kar sakte hain.


Example

Employee Salary Report ↓ T1 Calculates Total ↓ T2 Updates Salaries ↓ Wrong Summary Generated

Concurrency Control Objectives


Concurrency Control Process

Multiple Transactions ↓ Conflict Detection ↓ Apply Control Mechanism ↓ Safe Execution ↓ Consistent Database

Techniques Used

Concurrency Control │ ├── Lock Based Protocol ├── Timestamp Protocol ├── Validation Protocol └── Multi Version Control

RGPV syllabus me mainly Lock Based Protocol aur Two Phase Locking important hai.


Real Life Example

ATM machine aur Mobile Banking App dono same account access kar rahe hain.

ATM ↓ Account ↑ Mobile Banking ------------------- Concurrency Control ↓ Correct Balance

Memory Trick

Lost Update ↓ Overwrite ------------------- Dirty Read ↓ Read Uncommitted Data ------------------- Inconsistent Analysis ↓ Wrong Calculation ------------------- Incorrect Summary ↓ Wrong Total

Summary Table

Problem Meaning
Lost Update Update Overwritten
Dirty Read Read Uncommitted Data
Uncommitted Dependency Depend on Uncommitted Data
Inconsistent Analysis Wrong Analysis Result
Incorrect Summary Wrong Total Calculation

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

Lock Based Protocols

Lock Based Protocols DBMS me concurrency control achieve karne ka sabse popular method hai. Is technique me transaction kisi data item ko access karne se pehle lock acquire karti hai.

Locking ensure karta hai ki ek time par sirf authorized transactions hi data access kar sake aur database consistency maintain rahe.


Definition

A Lock Based Protocol is a concurrency control technique in which a transaction must obtain a lock before accessing a data item.


Need of Locking


Basic Concept

Transaction ↓ Request Lock ↓ Access Data ↓ Release Lock

Lock Manager

Lock Manager DBMS component hai jo locks ko manage karta hai.

Transaction ↓ Lock Manager ↓ Database

Types of Locks

Locks │ ├── Shared Lock (S) └── Exclusive Lock (X)

1. Shared Lock (S-Lock)

Shared Lock read operations ke liye use hota hai.

Ek hi data item par multiple transactions Shared Lock hold kar sakti hain.


Example

T1 Read(A) ↓ Shared Lock ------------------ T2 Read(A) ↓ Shared Lock

Characteristics


2. Exclusive Lock (X-Lock)

Exclusive Lock write operations ke liye use hota hai.

Jab ek transaction Exclusive Lock hold karti hai tab koi aur transaction us data item ko read ya write nahi kar sakti.


Example

T1 Write(A) ↓ Exclusive Lock ------------------- T2 Read(A) ↓ Wait

Characteristics


Lock Compatibility Matrix

Existing Lock Requested S Requested X
S ✅ Allowed ❌ Not Allowed
X ❌ Not Allowed ❌ Not Allowed

Compatibility Explanation

S + S ↓ Allowed ------------------- S + X ↓ Not Allowed ------------------- X + X ↓ Not Allowed

Locking Procedure

Request Lock ↓ Lock Granted? ↓ YES → Execute ↓ NO → Wait

Lock Conversion

Kabhi-kabhi transaction ko Shared Lock se Exclusive Lock me convert karna padta hai.


Types of Conversion

Lock Conversion │ ├── Upgrade └── Downgrade

1. Upgrade

Shared Lock ko Exclusive Lock me convert karna Upgrade kehlata hai.


Example

Shared Lock ↓ Exclusive Lock

2. Downgrade

Exclusive Lock ko Shared Lock me convert karna Downgrade kehlata hai.


Example

Exclusive Lock ↓ Shared Lock

Lock Table

DBMS lock information maintain karne ke liye Lock Table use karta hai.

Data Item Lock Type Transaction
A S T1
B X T2

Advantages of Lock Based Protocols


Disadvantages


Real Life Example

Suppose ATM aur Mobile Banking App same account access kar rahe hain.

ATM ↓ Exclusive Lock ↓ Update Balance ------------------- Mobile App ↓ Wait

Isse incorrect balance update hone se bach jata hai.


Memory Trick

Shared Lock ↓ Read ------------------- Exclusive Lock ↓ Write ------------------- S + S ↓ Allowed ------------------- S + X ↓ Not Allowed

Summary Table

Lock Type Purpose
Shared Lock Read Operation
Exclusive Lock Write Operation

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

Two Phase Locking (2PL)

Two Phase Locking (2PL) DBMS ka sabse important concurrency control protocol hai. Ye protocol ensure karta hai ki generated schedules conflict serializable hon.

RGPV examinations me 2PL bahut frequently poocha jata hai aur ye Unit 4 ka highest scoring topic mana jata hai.


Definition

Two Phase Locking is a locking protocol in which a transaction follows two phases: Growing Phase and Shrinking Phase.


Basic Idea

Transaction pehle locks acquire karti hai aur baad me locks release karti hai.

Ek baar lock release karne ke baad naya lock acquire nahi kiya ja sakta.


Two Phases of 2PL

Two Phase Locking │ ├── Growing Phase └── Shrinking Phase

1. Growing Phase

Growing Phase me transaction locks acquire kar sakti hai lekin release nahi kar sakti.


Rules


Example

Lock(A) ↓ Lock(B) ↓ Lock(C)

2. Shrinking Phase

Shrinking Phase me transaction locks release kar sakti hai lekin naya lock acquire nahi kar sakti.


Rules


Example

Unlock(A) ↓ Unlock(B) ↓ Unlock(C)

2PL Diagram

Growing Phase Acquire Locks ↑ ↑ Lock Point ↓ ↓ Release Locks Shrinking Phase

Lock Point

Lock Point wo point hota hai jahan transaction apna last lock acquire karti hai.

Lock Point ke baad transaction Shrinking Phase me enter kar jati hai.


Example of 2PL

Lock(A) ↓ Read(A) ↓ Lock(B) ↓ Write(B) ↓ Unlock(A) ↓ Unlock(B)

Ye transaction Two Phase Locking follow karti hai.


Advantages of 2PL


Disadvantages of 2PL


Strict Two Phase Locking (Strict 2PL)

Strict 2PL basic 2PL ka improved version hai.

Isme transaction apne sabhi Exclusive Locks transaction ke commit ya abort hone tak hold karti hai.


Definition

In Strict 2PL, all Exclusive Locks are released only after COMMIT or ROLLBACK.


Working

Lock(A) ↓ Write(A) ↓ Lock(B) ↓ Write(B) ↓ COMMIT ↓ Unlock(A) ↓ Unlock(B)

Advantages of Strict 2PL


Rigorous Two Phase Locking

Rigorous 2PL Strict 2PL se bhi stronger protocol hai.

Isme Shared aur Exclusive dono locks transaction completion tak hold kiye jaate hain.


Definition

In Rigorous 2PL, all locks (Shared and Exclusive) are released only after transaction commit or abort.


Working

Lock(A) ↓ Read(A) ↓ Lock(B) ↓ Write(B) ↓ COMMIT ↓ Release All Locks

Benefits of Rigorous 2PL


2PL vs Strict 2PL vs Rigorous 2PL

Feature 2PL Strict 2PL Rigorous 2PL
Conflict Serializable
Deadlock Possible
Prevent Dirty Read
Hold X Locks Till Commit
Hold All Locks Till Commit

Real Life Example

Suppose banking transaction account balance update kar rahi hai.

Account Update ↓ Exclusive Lock ↓ Transaction Complete ↓ Release Lock

Isse dusri transaction incorrect balance access nahi kar paati.


Memory Trick

2PL ↓ Grow + Shrink ------------------- Strict 2PL ↓ X Lock Till Commit ------------------- Rigorous 2PL ↓ All Locks Till Commit

Exam Shortcut

Protocol Remember
2PL Growing + Shrinking
Strict 2PL X Lock Till Commit
Rigorous 2PL All Locks Till Commit

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

Deadlock

Deadlock DBMS me ek serious concurrency problem hai. Ye tab hota hai jab do ya adhik transactions ek dusre ke resources ka wait karte rehte hain aur koi bhi transaction aage execute nahi kar paati.

Deadlock ki wajah se system permanently blocked state me chala ja sakta hai.


Definition

A Deadlock is a situation in which two or more transactions wait indefinitely for each other to release resources.


Simple Example

T1 Holds Lock(A) ↓ Waiting For Lock(B) --------------------- T2 Holds Lock(B) ↓ Waiting For Lock(A)

Ab T1 aur T2 dono wait kar rahe hain.

Is situation ko Deadlock kehte hain.


Deadlock Representation

T1 → T2 ↑ ↓ T2 ← T1

Cycle present hai, therefore Deadlock exists.


Necessary Conditions of Deadlock

Deadlock hone ke liye following 4 conditions simultaneously satisfy honi chahiye.


1. Mutual Exclusion

Resource ek time par sirf ek transaction use kar sakti hai.


2. Hold and Wait

Transaction ek resource hold karke dusre resource ka wait karti hai.


3. No Preemption

Resource ko forcefully transaction se wapas nahi liya ja sakta.


4. Circular Wait

Transactions circular chain me ek dusre ka wait kar rahi hoti hain.


Deadlock Conditions Diagram

Mutual Exclusion ↓ Hold and Wait ↓ No Preemption ↓ Circular Wait ↓ DEADLOCK

Wait-For Graph

Deadlock detection ke liye Wait-For Graph use kiya jata hai.


Definition

Wait-For Graph is a directed graph used to represent waiting relationships among transactions.


Rules


Example

T1 → T2 T2 → T3 T3 → T1

Cycle present hai.

Deadlock Exists.


Deadlock Handling Techniques

Deadlock Handling │ ├── Prevention ├── Avoidance ├── Detection └── Recovery

1. Deadlock Prevention

Deadlock Prevention ka objective deadlock ko hone hi na dena hai.


Methods


Circular Wait Prevention

Resources ko fixed ordering me allocate kiya jata hai.

Resource A ↓ Resource B ↓ Resource C

Transactions isi order me resources request karengi.


Advantages


Disadvantages


2. Deadlock Avoidance

Deadlock Avoidance future deadlock possibility ko check karke resource allocate karta hai.


Basic Idea

Request Resource ↓ Safe State? ↓ YES → Grant ↓ NO → Wait

Safe State

Aisi state jahan sabhi transactions future me successfully complete ho sakti hain.


Unsafe State

Aisi state jo deadlock create kar sakti hai.


Example Algorithm

Banker's Algorithm

3. Deadlock Detection

Detection technique deadlock hone deti hai aur baad me detect karti hai.


Method

Create Wait-For Graph ↓ Check Cycle ↓ Cycle Found? ↓ Deadlock Exists

Deadlock Detection Example

T1 → T2 ↓ T2 → T3 ↓ T3 → T1

Cycle detected.

Deadlock confirmed.


Advantages


Disadvantages


4. Deadlock Recovery

Deadlock detect hone ke baad system ko normal state me lana recovery kehlata hai.


Methods

Deadlock Recovery │ ├── Transaction Termination └── Resource Preemption

Transaction Termination

Ek ya adhik transactions abort kar di jati hain.


Example

Deadlock ↓ Abort T2 ↓ Release Resources ↓ Continue Execution

Resource Preemption

Kisi transaction se resource forcefully le kar dusri transaction ko diya jata hai.


Deadlock Prevention vs Avoidance vs Detection

Technique Idea
Prevention Do Not Allow Deadlock
Avoidance Avoid Unsafe State
Detection Find Deadlock After Occurrence
Recovery Resolve Deadlock

Real Life Example

Suppose do students library me books exchange kar rahe hain.

Student A Holding Book 1 Waiting Book 2 ------------------- Student B Holding Book 2 Waiting Book 1

Dono wait karte rahenge.

This is a Deadlock situation.


Memory Trick

Deadlock ↓ 4 Conditions ↓ ME HW NP CW ------------------- Mutual Exclusion Hold and Wait No Preemption Circular Wait

Exam Shortcut

Concept Remember
Deadlock Transactions Waiting Forever
Wait-For Graph Cycle Means Deadlock
Prevention Stop Before Deadlock
Avoidance Safe State
Detection Find Cycle
Recovery Abort Transaction

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

Recovery Techniques

Recovery Techniques DBMS ka important component hain jo database failures ke baad database ko correct aur consistent state me restore karne ka kaam karti hain.

Database systems me hardware failure, software failure, power failure aur transaction failure kisi bhi samay ho sakte hain. Recovery mechanism ensure karta hai ki data loss na ho aur database consistency maintain rahe.


Definition

Recovery is the process of restoring a database to a correct and consistent state after a failure.


Need of Recovery


Recovery System Goals

Database Failure ↓ Detect Failure ↓ Recover Database ↓ Restore Consistency ↓ Normal Execution

Types of Failures

Database Failures │ ├── Transaction Failure ├── System Failure ├── Media Failure └── Communication Failure

1. Transaction Failure

Transaction execution ke dauran error aane par transaction fail ho jati hai.


Causes


Example

Transaction ↓ Divide By Zero Error ↓ Rollback

2. System Failure

System crash hone par memory contents lost ho jaate hain lekin database files disk par safe rehti hain.


Causes


Example

Transaction Running ↓ Power Failure ↓ System Crash

3. Media Failure

Media Failure disk ya storage device damage hone ki wajah se hoti hai.


Causes


Example

Hard Disk Failure ↓ Database Files Lost

4. Communication Failure

Distributed database systems me network communication failure ho sakta hai.


Example

Server ↓ Network Failure ↓ Client Disconnected

Recovery Management

Recovery Manager DBMS ka component hai jo failures ko handle karta hai aur database ko restore karta hai.


Functions of Recovery Manager


Recovery Operations

Recovery │ ├── Undo Operation └── Redo Operation

Undo Operation

Undo operation failed transaction ke changes ko reverse karta hai.


Example

Before Update Balance = 1000 ↓ Failed Transaction ↓ Undo ↓ Balance = 1000

Redo Operation

Redo operation committed transaction ke changes ko database me dubara apply karta hai.


Example

Transaction Committed ↓ System Crash ↓ Redo ↓ Restore Changes

Recovery Process

Failure Occurs ↓ Analyze Logs ↓ Undo Failed Transactions ↓ Redo Committed Transactions ↓ Database Restored

Recovery Techniques

Recovery Techniques │ ├── Log Based Recovery ├── Shadow Paging ├── Checkpoints └── Backup Recovery

RGPV syllabus me mainly Log Based Recovery aur Checkpoints important hain.


Advantages of Recovery Techniques


Real Life Example

Suppose online banking transaction successfully commit ho gayi aur uske baad power failure ho gaya.

Transaction Commit ↓ Power Failure ↓ Recovery System ↓ Redo ↓ Balance Restored

Memory Trick

UNDO ↓ Remove Failed Changes ------------------- REDO ↓ Restore Committed Changes ------------------- Recovery ↓ Consistency

Failure Classification Summary

Failure Type Description
Transaction Failure Single Transaction Error
System Failure System Crash
Media Failure Disk Failure
Communication Failure Network Problem

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

Log Based Recovery

Log Based Recovery DBMS ki sabse important recovery technique hai. Is method me database ke har important operation ka record ek special file me maintain kiya jata hai jise Log File kehte hain.

System failure ke baad isi log file ki help se database ko recover kiya jata hai.


Definition

Log Based Recovery is a recovery technique in which all database updates are recorded in a log file before they are written to the database.


What is a Log File?

Log File ek sequential file hoti hai jo transaction activities store karti hai.


Information Stored in Log File

Transaction ID ↓ Data Item ↓ Old Value ↓ New Value ↓ Commit Status

Example of Log Record

Meaning:


Write Ahead Logging (WAL)

Log Based Recovery WAL principle follow karti hai.


Rule

Database update karne se pehle log file update karna compulsory hota hai.

Write Log ↓ Update Database

Benefits of WAL


Log Based Recovery Types

Log Based Recovery │ ├── Deferred Update └── Immediate Update

Deferred Update

Deferred Update technique me transaction ke updates database me immediately write nahi kiye jaate.

Updates pehle log file me store hote hain aur COMMIT ke baad database me apply kiye jaate hain.


Definition

Deferred Update is a recovery technique in which database updates are postponed until transaction commit.


Working

Transaction ↓ Update Log ↓ COMMIT ↓ Update Database

Example

T1 ↓ Update Balance ↓ Store in Log ↓ COMMIT ↓ Database Updated

Recovery Rule

Deferred Update me Undo ki zarurat nahi hoti.

Sirf Redo operation perform kiya jata hai.

Deferred Update ↓ REDO Only

Advantages


Disadvantages


Immediate Update

Immediate Update technique me changes database me commit se pehle bhi write kiye ja sakte hain.


Definition

Immediate Update is a recovery technique in which database may be updated before transaction commit.


Working

Transaction ↓ Update Log ↓ Update Database ↓ COMMIT

Example

T1 ↓ Update Balance ↓ Database Updated ↓ COMMIT

Recovery Rule

Immediate Update me transaction fail ho sakti hai after database update.

Isliye Undo aur Redo dono required hote hain.

Immediate Update ↓ UNDO + REDO

Deferred vs Immediate Update

Feature Deferred Update Immediate Update
Database Updated After Commit Before Commit
Undo Required No Yes
Redo Required Yes Yes
Complexity Low High

Checkpoints

Checkpoint recovery process ko faster banane ke liye use kiya jata hai.

Checkpoint create hone ke baad DBMS ko pura log file scan nahi karna padta.


Definition

A Checkpoint is a point in time at which the DBMS saves the current database state for recovery purposes.


Need of Checkpoints


Checkpoint Process

Suspend Transactions ↓ Write Buffers ↓ Write Checkpoint Record ↓ Resume Transactions

Checkpoint Example

Log Records ↓ Checkpoint ↓ New Log Records ↓ Failure

Recovery checkpoint ke baad wale records se start hogi.


Advantages of Checkpoints


Recovery with Checkpoint

System Crash ↓ Locate Checkpoint ↓ Scan Recent Logs ↓ Undo / Redo ↓ Database Restored

Real Life Example

Suppose banking server har 10 minutes me checkpoint create karta hai.

Agar crash ho jaye to DBMS ko poore din ka log scan nahi karna padega.

Checkpoint ↓ Crash ↓ Fast Recovery

Memory Trick

Deferred ↓ Redo Only ------------------- Immediate ↓ Undo + Redo ------------------- Checkpoint ↓ Fast Recovery

Exam Shortcut

Concept Remember
Deferred Update Redo Only
Immediate Update Undo + Redo
Checkpoint Fast Recovery
WAL Log First

RGPV Exam Keywords


Most Expected Questions

2 Marks

5 Marks

7 Marks

14 Marks

DBMS Unit 4 Important Questions

The following questions are selected from RGPV previous year examination papers, repeated university questions and expected topics for upcoming examinations.


🔥 Top Important 2 Marks Questions

Define Transaction.
What are ACID Properties?
What is Atomicity?
What is Serializability?
What is Conflict Serializability?
What is View Serializability?
What is Shared Lock?
What is Exclusive Lock?
What is Two Phase Locking?
Define Deadlock.
What is Undo Operation?
What is Redo Operation?

⭐ Top Important 5 Marks Questions

Explain ACID Properties.
Explain Transaction States.
Explain Serial and Concurrent Schedules.
Explain Conflict Serializability.
Explain View Serializability.
Explain Lock Based Protocols.
Explain Shared and Exclusive Locks.
Explain Deadlock.
Explain Recovery Techniques.
Explain Checkpoint Mechanism.

🏆 Top Important 7 Marks Questions

Explain Transaction Processing with example.
Explain Transaction States with diagram.
Explain Conflict Serializability using Precedence Graph.
Differentiate Conflict and View Serializability.
Discuss Concurrency Control Problems.
Explain Two Phase Locking Protocol.
Discuss Deadlock Prevention Techniques.
Explain Deadlock Detection using Wait-For Graph.
Differentiate Deferred and Immediate Update.
Explain Log Based Recovery.

🚀 Most Important 14 Marks Questions

Explain Transaction Processing and ACID Properties with suitable examples.
Explain Transaction States with state transition diagram.
Explain Schedules and Serializability in DBMS.
Explain Conflict Serializability and View Serializability with examples.
Discuss Concurrency Control and its problems.
Explain Lock Based Protocols and Lock Compatibility Matrix.
Explain Two Phase Locking, Strict 2PL and Rigorous 2PL.
Explain Deadlock Prevention, Avoidance, Detection and Recovery.
Explain Recovery Techniques and Failure Classification.
Explain Log Based Recovery, WAL and Checkpoints.

DBMS Unit 4 PYQ Analysis

The following analysis is based on RGPV Previous Year Question Papers and recent examination trends. Unit 4 is one of the most important units because it contains Transaction Management, Concurrency Control and Recovery Concepts.


Topics Covered

Transaction Processing
ACID Properties
Transaction States
Schedules
Serializability
Conflict Serializability
View Serializability
Concurrency Control
Lock Based Protocols
Two Phase Locking
Deadlock
Recovery Techniques
Log Based Recovery
Checkpoints

PYQ Frequency Analysis

Topic 2020 2022 2023 2025 Frequency
ACID Properties ★★★★★
Serializability ★★★★★
Conflict Serializability ★★★★★
Two Phase Locking ★★★★★
Deadlock ★★★★☆
Recovery Techniques ★★★★☆
Log Based Recovery ★★★★☆
Checkpoint ★★★☆☆

Most Repeated Unit 4 Questions

🔥 Q1. Explain ACID Properties with suitable examples.

Appeared In:

Prediction: ⭐⭐⭐⭐⭐


🔥 Q2. Explain Conflict Serializability using Precedence Graph.

Appeared In:

Prediction: ⭐⭐⭐⭐⭐


🔥 Q3. Explain Two Phase Locking Protocol.

Appeared In:

Prediction: ⭐⭐⭐⭐⭐


🔥 Q4. Explain Deadlock and Wait-For Graph.

Appeared In:

Prediction: ⭐⭐⭐⭐⭐


🔥 Q5. Explain Log Based Recovery.

Appeared In:

Prediction: ⭐⭐⭐⭐☆


2026 Expected Questions

VERY HIGH PROBABILITY 🔥 ACID Properties 🔥 Serializability 🔥 Conflict Serializability 🔥 Two Phase Locking 🔥 Deadlock -------------------------------- HIGH PROBABILITY ⭐ View Serializability ⭐ Lock Based Protocols ⭐ Recovery Techniques ⭐ Log Based Recovery ⭐ Checkpoints

Actual RGPV Trend

Unit 4 me Transaction Management aur Concurrency Control sabse zyada focus area raha hai.

TOP REPEATED TOPICS 1. ACID Properties 2. Conflict Serializability 3. Two Phase Locking 4. Deadlock 5. Recovery Techniques

Unit 4 Weightage Analysis

Topic Importance
ACID Properties ★★★★★
Conflict Serializability ★★★★★
Two Phase Locking ★★★★★
Deadlock ★★★★★
Recovery Techniques ★★★★★
View Serializability ★★★★☆
Lock Based Protocols ★★★★☆
Log Based Recovery ★★★★☆
Checkpoint ★★★☆☆

2026 Score Booster Topics

✓ ACID Properties ✓ Conflict Serializability ✓ Two Phase Locking ✓ Deadlock ✓ Recovery Techniques ✓ Log Based Recovery ✓ Lock Based Protocols

If these topics are prepared thoroughly, around 75–85% of Unit 4 expected examination pattern can be covered.

Frequently Asked Questions (FAQs)


What is a Transaction in DBMS?

A Transaction is a logical unit of work that contains one or more database operations and changes the database from one consistent state to another consistent state.


What are ACID Properties?

ACID Properties are Atomicity, Consistency, Isolation and Durability. These properties ensure reliable transaction processing in DBMS.


What is Serializability?

Serializability is a correctness concept that ensures a concurrent schedule gives the same result as some serial schedule.


What is Conflict Serializability?

Conflict Serializability checks whether a schedule can be converted into a serial schedule by swapping non-conflicting operations.


What is Two Phase Locking?

Two Phase Locking is a locking protocol in which a transaction has two phases: Growing Phase and Shrinking Phase.


What is Deadlock?

Deadlock is a situation where two or more transactions wait indefinitely for each other to release resources.


What is Log Based Recovery?

Log Based Recovery is a recovery technique where all database changes are recorded in a log file before being applied to the database.


What is a Checkpoint?

A Checkpoint is a recovery point where DBMS saves the current database state to reduce recovery time after failure.

DBMS Unit 4 Quick Revision Sheet

TRANSACTION ↓ Logical Unit of Work -------------------------------- ACID ↓ Atomicity Consistency Isolation Durability -------------------------------- TRANSACTION STATES ↓ Active Partially Committed Committed Failed Aborted -------------------------------- SCHEDULES ↓ Serial Schedule Non-Serial Schedule Concurrent Schedule -------------------------------- SERIALIZABILITY ↓ Concurrent But Correct -------------------------------- CONFLICT SERIALIZABILITY ↓ Precedence Graph No Cycle = Serializable -------------------------------- VIEW SERIALIZABILITY ↓ Same Read Same Write Same Final Result -------------------------------- CONCURRENCY CONTROL ↓ Lost Update Dirty Read Inconsistent Analysis -------------------------------- LOCKS ↓ Shared Lock = Read Exclusive Lock = Write -------------------------------- 2PL ↓ Growing Phase Shrinking Phase -------------------------------- DEADLOCK ↓ Waiting Forever -------------------------------- RECOVERY ↓ Undo Redo Log Checkpoint

Last Minute Exam Revision

Topic Priority
ACID Properties ★★★★★
Conflict Serializability ★★★★★
Two Phase Locking ★★★★★
Deadlock ★★★★★
Recovery Techniques ★★★★★
Lock Based Protocols ★★★★☆
Log Based Recovery ★★★★☆
View Serializability ★★★★☆
Checkpoints ★★★☆☆

Related DBMS Units

DBMS Unit 1 DBMS Unit 2 DBMS Unit 3 DBMS Unit 5

Conclusion

DBMS Unit 4 covers transaction management, concurrency control and database recovery. These topics are very important because they explain how DBMS maintains correctness, consistency and reliability in multi-user environments.

🏆 UNIT 4 SCORE BOOSTER Must Prepare: ✓ ACID Properties ✓ Conflict Serializability ✓ Two Phase Locking ✓ Deadlock ✓ Recovery Techniques ✓ Log Based Recovery ✓ Checkpoints