1. Gyanastra
  2. Database Systems
  3. Concurrency Control (Locking)
  4. Concurrency Control Protocols Overview
Free lesson, no account needed 5 min read 11 practice questions after it
Asked in past papers3 times
  • GATE CSE20172010
  • UGC NET2014

Database Systems · Concurrency Control (Locking)

Concurrency Control Protocols Overview

Overview

A schedule is correct only if it is equivalent to some serial schedule.
Earlier methods tested this equivalence after the schedule had already executed; concurrency control protocols instead enforce rules during execution so that only safe (serializable-equivalent) schedules are produced.
Locking is the main mechanism: a data item is locked, and the rules decide when to lock, when to release, and who may access it.

Key concepts

  • Schedule correctness: a schedule must give correct answers or consistent results, i.e. it must be equivalent to a serial schedule.
  • Serializability testing (conflict serializable / view serializable): a post-execution check asking whether the executed schedule is equivalent to some serial schedule.
  • Protocol: simply a rule.
  • Concurrency control protocols: concurrency control rules; if they are followed, the generated schedules are equivalent to serial schedules.
  • Safe execution: an operation that is about to violate a rule (for example a serializability rule) is not allowed; the schedule can execute only if it is equivalent to a serial schedule.
  • Locking: locking a data item; a lock can be applied at any level. Locking rules must specify when to lock, when to release the lock, and who can access the data item.
  • Lock-based protocols: locking a data item at any level, with rules for when to lock, when to release, and who can access. Two types:
    • Two-phase locking protocol (2PL): Basic 2PL, Conservative 2PL, Strict 2PL, Rigorous 2PL
    • Graph-based protocol
  • Timestamp-based protocols: based on the values of the times at which data is accessed. Two varieties: Timestamp ordering protocol and Thomas Write Rule.
  • Multi-granularity protocol: a listed protocol family.
  • Multi-version protocol: a listed protocol family, with variants multi-version 2PL and a second multi-version variant (name unclear in the source).
Figure. Notice that protocols enforce rules during execution so schedules stay equivalent to serial schedules. Lock-based splits into 2PL variants and graph-based; timestamp-based splits into timestamp ordering and Thomas Write Rule.

How it works

  1. A schedule must be equivalent to a serial schedule to be correct.
  2. Earlier tests check this equivalence after execution.
  3. Concurrency control protocols instead give rules that are checked while the schedule is executing.
  4. If an operation would violate the rule, it is not permitted.
  5. Thus the protocol prevents the schedule from becoming non-serializable.

Protocol families covered:

  1. Lock-based protocols
    • Locking a data item at any level.
    • Rules specify when to lock, when to release, and who can access.
    • Types: Two-phase locking protocol (2PL) (Basic 2PL, Conservative 2PL, Strict 2PL, Rigorous 2PL) and Graph-based protocol.
  2. Timestamp-based protocols
    • Based on the values of the times at which data is accessed.
    • Varieties: Timestamp ordering protocol and Thomas Write Rule.
  3. Multi-granularity protocol
  4. Multi-version protocol
    • Variants: multi-version 2PL and a second multi-version variant (name unclear in the source).

Comparison

AspectSerializability testing (conflict / view)Concurrency control protocol
When appliedAfter execution of the scheduleDuring execution
What it doesTests whether the schedule is equivalent to a serial scheduleEnforces rules so that the schedule remains equivalent to a serial schedule
Action on violationThe schedule is identified as not serializable after the factThe violating operation is not allowed
ResultAccept or reject the schedule after executionGenerates only safe schedules that are equivalent to serial schedules
Protocol familyBasisVariants listed
Lock-basedLocks on data items; rules for when to lock, when to release, and who can accessTwo-phase locking: Basic 2PL, Conservative 2PL, Strict 2PL, Rigorous 2PL; Graph-based protocol
Timestamp-basedValues of times at which data is accessedTimestamp ordering protocol; Thomas Write Rule
Multi-granularityProtocol family based on multiple levels/granularities—
Multi-versionProtocol family using multiple versionsMulti-version 2PL; second variant (name unclear)

Revision summary

  • A protocol means a rule; concurrency control protocols are rules that ensure schedules are equivalent to serial schedules.
  • Serializability tests (conflict / view) are post-execution checks; protocols control the schedule during execution.
  • If an operation would violate a protocol rule, it is not allowed.
  • Locking means locking a data item; locking rules decide when to lock, when to release, and who can access.
  • Lock-based protocols: Two-phase locking (Basic 2PL, Conservative 2PL, Strict 2PL, Rigorous 2PL) and Graph-based protocol.
  • Timestamp-based protocols depend on the times of data access: Timestamp ordering protocol and Thomas Write Rule.
  • Other families: Multi-granularity protocol and Multi-version protocol (with multi-version 2PL and a second variant).
  • Memorize the exact classification and names of the variants.

Previous-year exam insights

  • Basic 2PL guarantees conflict serializability but does not prevent deadlock; Conservative 2PL is deadlock-free (all locks acquired before execution) but not starvation-free; Strict/Rigorous 2PL prevent cascading rollback.
    Asked inGATE 2010
  • Timestamp ordering protocol ensures conflict serializability and is deadlock-free (no locks are used), but it is not starvation-free because conflicting transactions may be repeatedly aborted and restarted.
    Asked inGATE 2010
  • Deadlock prevention by transaction timestamps uses the wait-die and wound-wait schemes: in wait-die an older transaction waits and a younger one is killed; in wound-wait an older transaction wounds (kills) the younger holder and a younger requester waits.
    Asked inGATE 2017
  • A timestamp-based deadlock-prevention scheme that always kills the requester (or always kills the holder) is deadlock-free but not starvation-free, because the same transaction may be repeatedly killed and restarted.
    Asked inGATE 2017
  • Lock-based protocols (2PL) can suffer deadlock and starvation; timestamp-based protocols avoid deadlock but can suffer starvation, so no single basic protocol guarantees both conflict serializability and freedom from deadlock and starvation simultaneously.
    Asked inGATE 2010
  • The Thomas Write Rule: if a transaction's write timestamp is older than the item's write timestamp, the write is ignored (not executed) rather than aborting the transaction, which can make some non-conflict-serializable schedules acceptable.
Pages 1–2 of 2