chapter

    Transactions, Concurrency Control and Recovery Short Notes for Gate Cs

    Transactions, Concurrency Control and Recovery short notes for GATE CS: 4 study cards covering concepts, formulas, shortcuts and exam traps, plus solved pract

    Transactions Concurrency Control and Recovery short notes

    Summary: ACID and Anomaly Quick Reference

    ACID Properties Quick Reference

    • Atomicity: All or nothing. (Mechanism: Undo Log)
    • Consistency: Valid state to valid state. (Mechanism: Application logic + Constraints)
    • Isolation: Concurrent = Serial. (Mechanism: Locks / Concurrency Control)
    • Durability: Committed = Permanent. (Mechanism: Redo Log)

    Concurrency Anomalies Matrix

    Anomaly Cause Property Violated
    Lost Update T1 and T2 read same value, both write. T2 overwrites T1. Isolation, Consistency
    Dirty Read T1 reads data written by T2, but T2 aborts. Isolation
    Unrepeatable Read T1 reads a row, T2 updates and commits it, T1 reads again. Isolation
    Phantom Read T1 queries a range, T2 inserts or deletes in that range and commits, T1 queries again. Isolation

    Diagnostic Heuristic: If a scenario describes a final database state that breaks a business rule (like total money changing), Consistency is violated. If it describes interleaving causing the error, Isolation is the root failure that allowed it.

    Summary: Conflict Serializability Checklist

    Summary: Conflict Serializability Checklist

    1. Identify Conflicts
    Look for pairs from different transactions, accessing the same data item, with at least one Write (, , ). Ignore .
    2. Draw Edges
    For each conflict, draw a directed edge if appears before in the schedule.
    3. Check for Cycles
    No Cycle Conflict Serializable. Cycle Exists Not Conflict Serializable.
    4. Find Equivalent Schedule
    If acyclic, the valid topological sorts of the graph represent the equivalent serial schedules.

    Topic Summary and Exam Checklist

    Topic Summary and Exam Checklist

    Core Definitions:
    • Recoverable: reads from T_i \implies Commit(T_i) < Commit(T_j).
    • Cascadeless: reads from T_i \implies Commit(T_i) < Read(T_j).
    • Strict: reads/writes from or Abort(T_i) < Read/Write(T_j).
    Hierarchy: Strict Cascadeless Recoverable.
    Crash Recovery Rules:
    • WAL: Log record to disk before data page to disk.
    • Checkpoint: Limits recovery scan range; records active transactions.
    • Redo: Applied to transactions with a <Commit> record after the last checkpoint.
    • Undo: Applied to transactions with a <Start> record but no <Commit> record.
    Exam Trap: A schedule can be recoverable but not cascadeless. Always check the exact definition requested in the question. Do not assume recoverable implies cascadeless.

    1 more card in this chapter

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    Level 1: Warm-up

    Assertion (A): A schedule is conflict serializable if its precedence graph contains no cycles.

    Reason (R): The nodes of the precedence graph represent the data items, and the edges represent the transactions.

    Question 2
    Level 1: Warm-up

    According to the conflict serializability checklist, what is the correct chronological order of the first two steps?

    1. Check for cycles
    2. Identify conflicting operations
    3. Draw directed edges
    Question 3
    Level 1: Warm-up

    In the conflict serializability checklist, what is the immediate next step after confirming that the precedence graph has no cycles?

    Question 4
    Level 1: Warm-up

    Consider the schedule . When constructing the precedence graph for conflict serializability, how many distinct directed edges are drawn between the transaction nodes?

    Question 5
    Level 1: Warm-up

    A database management system provides four mandatory guarantees for every transaction. If a transaction successfully commits, its changes are permanent and will survive any subsequent system failure, power loss, or crash. This specific guarantee is known as:

    Question 6
    Level 1: Warm-up

    Two operations from different transactions access the exact same data item. According to the core rule of conflicting operations, what is the maximum number of write operations that can be present in this pair such that the pair is guaranteed to NEVER conflict?

    Question 7
    Level 1: Warm-up

    Consider the following statements about a conflict serializable schedule :

    Statement 1: is guaranteed to be free of concurrency anomalies like Lost Updates.

    Statement 2: must be conflict equivalent to every possible serial schedule of its transactions.

    Which of the statements is/are true?

    Question 8
    Level 1: Warm-up

    Match the following operation sequence with the correct edge drawn in the precedence graph.

    Sequence: occurs before

    Question 9
    Level 1: Warm-up

    Match the following schedule with the correct set of directed edges in its precedence graph.

    Schedule:

    Question 10
    Level 1: Warm-up

    Match the following schedule with the correct set of directed edges in its precedence graph.

    Schedule:

    Free preview ends here

    Login to view the complete short notes

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Transactions, Concurrency Control and Recovery Short Notes for GATE CS

    Transactions, Concurrency Control and Recovery short notes for GATE CS: 4 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.

    Summary: ACID and Anomaly Quick Reference

    ACID Properties Quick Reference

    • Atomicity: All or nothing. (Mechanism: Undo Log)
    • Consistency: Valid state to valid state. (Mechanism: Application logic + Constraints)
    • Isolation: Concurrent = Serial. (Mechanism: Locks / Concurrency Control)
    • Durability: Committed = Permanent. (Mechanism: Redo Log)

    Concurrency Anomalies Matrix

    Anomaly Cause Property Violated
    Lost Update T1 and T2 read same value, both write. T2 overwrites T1. Isolation, Consistency
    Dirty Read T1 reads data written by T2, but T2 aborts. Isolation
    Unrepeatable Read T1 reads a row, T2 updates and commits it, T1 reads again. Isolation
    Phantom Read T1 queries a range, T2 inserts or deletes in that range and commits, T1 queries again. Isolation

    Diagnostic Heuristic: If a scenario describes a final database state that breaks a business rule (like total money changing), Consistency is violated. If it describes interleaving causing the error, Isolation is the root failure that allowed it.

    Summary: Conflict Serializability Checklist

    Summary: Conflict Serializability Checklist

    1. Identify Conflicts
    Look for pairs from different transactions, accessing the same data item, with at least one Write (, , ). Ignore .
    2. Draw Edges
    For each conflict, draw a directed edge if appears before in the schedule.
    3. Check for Cycles
    No Cycle Conflict Serializable. Cycle Exists Not Conflict Serializable.
    4. Find Equivalent Schedule
    If acyclic, the valid topological sorts of the graph represent the equivalent serial schedules.

    Topic Summary and Exam Checklist

    Topic Summary and Exam Checklist

    Core Definitions:
    • Recoverable: reads from T_i \implies Commit(T_i) &lt; Commit(T_j).
    • Cascadeless: reads from T_i \implies Commit(T_i) &lt; Read(T_j).
    • Strict: reads/writes from or Abort(T_i) &lt; Read/Write(T_j).
    Hierarchy: Strict Cascadeless Recoverable.
    Crash Recovery Rules:
    • WAL: Log record to disk before data page to disk.
    • Checkpoint: Limits recovery scan range; records active transactions.
    • Redo: Applied to transactions with a <Commit> record after the last checkpoint.
    • Undo: Applied to transactions with a <Start> record but no <Commit> record.
    Exam Trap: A schedule can be recoverable but not cascadeless. Always check the exact definition requested in the question. Do not assume recoverable implies cascadeless.

    Exam Readiness Checklist

    Exam Readiness Checklist

    Core Rules to Memorize:
    • 2PL Definition: Growing phase (acquire only) Lock Point Shrinking phase (release only).
    • Guarantee: 2PL Conflict Serializability.
    • Non-Guarantee: 2PL Deadlock Freedom.
    • Non-Guarantee: 2PL Recoverability (unless Strict).
    • Logic: 2PL is a sufficient condition for conflict serializability, but not necessary.
    Variant Cheat Sheet:
    • Basic 2PL: Release anytime after lock point.
    • Strict 2PL: Hold X-locks until Commit/Abort. (Prevents cascading rollbacks).
    • Rigorous 2PL: Hold All locks (S and X) until Commit/Abort.
    Exam Strategy: When asked "Which schedule is 2PL?", check each transaction individually for any Lock occurring after an Unlock. When asked about recoverability, immediately check if Exclusive locks are held until commit (Strict 2PL).

    Transactions, Concurrency Control and Recovery: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Databases MCQ

    Assertion (A): A schedule is conflict serializable if its precedence graph contains no cycles.

    Reason (R): The nodes of the precedence graph represent the data items, and the edges represent the transactions.

    1. A.

      Both A and R are true and R is the correct explanation of A

    2. B.

      Both A and R are true but R is NOT the correct explanation of A

    3. C.

      A is true but R is false

    4. D.

      A is false but R is true

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: The precedence graph uses transactions as nodes and conflicts as directed edges.

    Step 1: Evaluate Assertion (A). The golden rule of the precedence graph method is that an acyclic graph (no cycles) means the schedule is conflict serializable. Assertion (A) is true.

    Step 2: Evaluate Reason (R). The reason states that nodes are data items and edges are transactions. This is backwards. The nodes represent the transactions (), and the directed edges represent the conflicts (e.g., ). Reason (R) is false.

    Answer: A is true but R is false.

    Question 2 · Databases MCQ

    According to the conflict serializability checklist, what is the correct chronological order of the first two steps?

    1. Check for cycles
    2. Identify conflicting operations
    3. Draw directed edges
    1. A.

      2 then 3

    2. B.

      1 then 2

    3. C.

      3 then 1

    4. D.

      2 then 1

    Correct Answer:

    A

    Step-by-Step Solution

    Insight: You cannot check for cycles or sort a graph that has not been constructed yet.

    Exam route: The checklist order is: 1. Identify conflicts, 2. Draw edges, 3. Check for cycles. The first two steps are 2 then 3 (Identify conflicts, then Draw edges).

    Learning route: To test conflict serializability, you must first find the raw material (conflicting operations). Only after identifying them can you draw the directed edges between transactions. Checking for cycles is the third step, performed after the graph is fully drawn. Thus, the correct chronological order of the first two steps is 2 then 3.

    Answer: 2 then 3

    Question 3 · Databases MCQ

    In the conflict serializability checklist, what is the immediate next step after confirming that the precedence graph has no cycles?

    1. A.

      Identify all conflicting operations

    2. B.

      Draw directed edges between transactions

    3. C.

      Use topological sorting to find the equivalent serial schedule

    4. D.

      Check for read-read illusions

    Correct Answer:

    C

    Step-by-Step Solution

    Insight: The checklist follows a strict logical sequence: find conflicts build graph check cycles find equivalent schedule.

    Exam route: After step 3 (Check for Cycles) confirms the graph is acyclic, step 4 is to use topological sorting to find the equivalent serial schedule.

    Learning route: The conflict serializability checklist is a sequential algorithm:

    1. Identify Conflicts: Find pairs from different transactions accessing the same item with at least one write.
    2. Draw Edges: Create directed edges based on chronological order.
    3. Check for Cycles: If a cycle exists, it is not conflict serializable. If no cycle exists, it is conflict serializable.
    4. Find Equivalent Schedule: If acyclic, perform topological sorting on the graph to determine the valid equivalent serial schedule(s).

    Therefore, the step immediately following "no cycles" is topological sorting.

    Answer: Use topological sorting to find the equivalent serial schedule

    Question 4 · Databases NAT

    Consider the schedule . When constructing the precedence graph for conflict serializability, how many distinct directed edges are drawn between the transaction nodes?

    Correct Answer:

    2.00

    Step-by-Step Solution

    Key idea: this is a direct application of the precedence graph construction method.

    Step 1: Identify all conflicting pairs of operations.

    • and : Conflict (Read-Write). before . Edge: .
    • and : Conflict (Read-Write). before . Edge: .
    • and : Conflict (Write-Write). before . Edge: .

    Step 2: List the distinct directed edges.

    Step 3: Count the distinct edges.

    There are exactly 2 distinct directed edges.

    Answer: 2.00

    Question 5 · Databases MCQ

    A database management system provides four mandatory guarantees for every transaction. If a transaction successfully commits, its changes are permanent and will survive any subsequent system failure, power loss, or crash. This specific guarantee is known as:

    1. A.

      Atomicity

    2. B.

      Consistency

    3. C.

      Isolation

    4. D.

      Durability

    Correct Answer:

    D

    Step-by-Step Solution

    Key idea: The question describes the permanence of changes after a commit, even in the event of a crash.

    Step 1: Recall the ACID properties.

    Step 2: Match the description to the correct property. 'Permanent after commit' and 'survive system failure' are the exact definitions of Durability.

    Step 3: Atomicity is all-or-nothing, Consistency is preserving rules, Isolation is preventing interference.

    Answer: Durability.

    Question 6 · Databases MCQ

    Two operations from different transactions access the exact same data item. According to the core rule of conflicting operations, what is the maximum number of write operations that can be present in this pair such that the pair is guaranteed to NEVER conflict?

    1. A.

      0

    2. B.

      1

    3. C.

      2

    4. D.

      It depends on the read operations

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: The core rule of conflicting operations states that at least one operation must be a write for a conflict to occur.

    Step 1: Recall the three conditions for a conflict: different transactions, same data item, and at least one write.

    Step 2: The question asks for the maximum number of writes in a pair that will NEVER conflict.

    Step 3: If there is 1 write (Read-Write or Write-Read), it conflicts. If there are 2 writes (Write-Write), it conflicts.

    Step 4: The only way to guarantee NO conflict is to have 0 writes (Read-Read).

    Answer: 0.

    Question 7 · Databases MCQ

    Consider the following statements about a conflict serializable schedule :

    Statement 1: is guaranteed to be free of concurrency anomalies like Lost Updates.

    Statement 2: must be conflict equivalent to every possible serial schedule of its transactions.

    Which of the statements is/are true?

    1. A.

      Statement 1 only

    2. B.

      Statement 2 only

    3. C.

      Both Statement 1 and Statement 2

    4. D.

      Neither Statement 1 nor Statement 2

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: Conflict serializability guarantees equivalence to SOME serial schedule, not EVERY serial schedule.

    Step 1: Evaluate Statement 1. A conflict serializable schedule is guaranteed to produce the same result as a serial schedule, meaning it is free of concurrency anomalies like Lost Updates. Statement 1 is true.

    Step 2: Evaluate Statement 2. The definition states that must be conflict equivalent to SOME serial schedule. Different serial schedules (e.g., vs ) produce different final states if there are conflicting writes. can only be equivalent to one specific order, not every possible order. Statement 2 is false.

    Answer: Statement 1 only.

    Question 8 · Databases MCQ

    Match the following operation sequence with the correct edge drawn in the precedence graph.

    Sequence: occurs before

    1. A.

    2. B.

    3. C.

      No edge

    4. D.

    Correct Answer:

    A

    Step-by-Step Solution

    Insight: Precedence graph edges always point from the transaction that performs the first conflicting operation to the transaction that performs the second.

    Exam route: The schedule has before . This is a Write-Read conflict. The edge must point from to .

    Learning route: Two operations conflict if they are from different transactions, access the same data item, and at least one is a write. Here, and conflict. Since appears chronologically before , the dependency is that must precede . Therefore, we draw a directed edge .

    Answer:

    Question 9 · Databases MCQ

    Match the following schedule with the correct set of directed edges in its precedence graph.

    Schedule:

    1. A.

    2. B.

    3. C.

      and

    4. D.

      No edges

    Correct Answer:

    C

    Step-by-Step Solution

    Insight: Precedence graph edges are drawn for every pair of conflicting operations, pointing from the earlier transaction to the later one.

    Exam route: On , precedes , creating . On , precedes , creating . Both edges exist.

    Learning route: We analyze the schedule data item by data item.

    Step 1: For data item , and conflict (Write-Read). Since acts before , we draw .

    Step 2: For data item , and conflict (Write-Read). Since acts before , we draw .

    Step 3: Combine the edges. The precedence graph contains both and (which forms a cycle, meaning it is not conflict serializable, but the question only asks for the edges).

    Answer: and

    Question 10 · Databases MCQ

    Match the following schedule with the correct set of directed edges in its precedence graph.

    Schedule:

    1. A.

      and

    2. B.

      only

    3. C.

      only

    4. D.

      No edges

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a conflict identification question requiring you to check each data item for cross-transaction conflicts.

    Step 1: Analyze data item . The schedule has followed by . This is a Write-Write conflict between different transactions. Since acts first, draw edge .

    Step 2: Analyze data item . The schedule has followed by . This is a Read-Read pair. Read-Read operations never conflict, so no edge is drawn for .

    Step 3: Combine the edges. The only edge in the graph is .

    Answer: only

    More short notes in this unit