Database Management System: ACID Properties

WieldyCherryTree avatar
WieldyCherryTree
·
·
Download

Start Quiz

Study Flashcards

10 Questions

What is the main purpose of the two-phase locking protocol?

To ensure serializability in concurrent transactions

What is the primary difference between strict 2PL and rigorous 2PL?

The type of locks released after a transaction commits or aborts

What is the consequence of a deadlock in a database system?

Transactions will wait indefinitely for a resource

What is the primary cause of starvation in a database system?

Transaction scheduling algorithm

What is the main goal of concurrency control mechanisms?

To ensure data consistency

What is the primary benefit of using timestamp ordering in concurrency control?

Increased concurrency

What is the main difference between conservative 2PL and basic 2PL?

The timing of lock acquisition

What is the main goal of the expanding phase in two-phase locking?

To acquire new locks

What is the primary benefit of using two-phase locking?

Guaranteed serializability

What is the main difference between a deadlock and starvation?

A deadlock occurs due to resource unavailability, while starvation occurs due to scheduling

Study Notes

Desirable Properties of Transactions

  • Atomicity: a transaction is performed in its entirety or not at all
  • Consistency preservation: takes database from one consistent state to another
  • Isolation: not interfered with by other transactions
  • Durability or permanency: changes must persist in the database

Transaction States

The Lost Update Problem

  • If T1 transfers 5 seat reservations from X to Y and T2 reserves 4 seats on X, the final result should be X = 79, but in the interleaving of operations, X = 84 because the update in T1 that removed the five seats from X was lost

The Temporary Update Problem

The Incorrect Summary Problem

The Unrepeatable Read Problem

  • Transaction T reads the same item twice, value is changed by another transaction T between the two reads, T receives different values for the two reads of the same item

Concurrency Control Based on Timestamp Ordering

  • Strict Timestamp Ordering:
    • If TS(T) > read_TS(X), then delay T until the transaction T’ that wrote or read X has terminated
    • If TS(T) > write_TS(X), then delay T until the transaction T’ that wrote or read X has terminated
  • Thomas’s Write Rule:
    • If read_TS(X) > TS(T) then abort and roll-back T and reject the operation
    • If write_TS(X) > TS(T), then just ignore the write operation and continue execution
    • Else, execute write_item(X) of T and set write_TS(X) to TS(T)

Guaranteeing Serializability by Two-Phase Locking

  • Two-phase locking protocol:
    • Expanding (growing) phase: new locks can be acquired but none can be released, lock conversion upgrades must be done during this phase
    • Shrinking phase: existing locks can be released but none can be acquired, downgrades must be done during this phase
  • The two phases must be mutually exclusive

Variations of Two-Phase Locking

  • Basic 2PL: technique described above
  • Conservative (static) 2PL: requires a transaction to lock all the items it accesses before the transaction begins
  • Strict 2PL: transaction does not release exclusive locks until after it commits or aborts
  • Rigorous 2PL: transaction does not release any locks until after it commits or aborts

Deadlock and Starvation

  • Deadlock: occurs when each transaction T in a set is waiting for some item locked by some other transaction T’
  • Starvation: occurs if a transaction cannot proceed for an indefinite period of time while other transactions continue normally
  • Solution: first-come-first-served queue

Learn about the desirable properties of transactions in a database management system, including atomicity, consistency preservation, isolation, and durability. Understanding these ACID properties is crucial for ensuring data integrity.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Use Quizgecko on...
Browser
Browser