Graph Based Concurrency Control Protocol in DBMS (original) (raw)

Last Updated : 25 Oct, 2025

In a Database Management System (DBMS), multiple transactions often execute concurrently, which can lead to conflicts when they access the same data items. The Graph-Based Concurrency Control Protocol manages these conflicts using a directed graph structure to ensure conflict serializability and consistency.

Before granting a lock, the system checks the graph:

**Note: Thus, the protocol ensures that the serialization graph remains acyclic, maintaining database consistency.

Properties

Partial Ordering Requirement

Before applying the protocol, a partial ordering is defined on the set of data items. Let the set of database items be D = {d₁, d₂, d₃, ..., dₙ}. If dᵢ -> dⱼ, then any transaction accessing both must access dᵢ before dⱼ.

**Note: This ordering forms a Directed Acyclic Graph (DAG) - called the Database Graph.

Tree Based Protocol

The Tree Protocol is a graph-based concurrency control method that ensures conflict serializability and deadlock freedom. Unlike Two-Phase Locking (2PL), it follows a hierarchical structure for locking data items.

Rules of Tree Protocol:

  1. **Only exclusive (X) locks are allowed: No shared (S) locks are used.
  2. **The first lock can be on any data item: After that, a transaction can lock a data item only if it has locked its parent first.
  3. **Data items can be unlocked at any time: There is no strict two-phase rule.
  4. **No relocking: Once a transaction unlocks a data item, it cannot lock it again.

**Note: The Tree Protocol offers a balance between concurrency and deadlock prevention, making it useful in certain database applications.

222

**Image - Database Graph

Let's look at an example based on the above Database Graph. We have three Transactions in this schedule and this is a skeleton example, i.e, we will only see how Locking and Unlocking work, let's keep this simple and not make this complex by adding operations on data.

**T 1 **T 2 **T 3
Lock-X(A)
Lock-X(B)
Lock-X(D)
Lock-X(H)
Unlock-X(D)
Lock-X(E)
Lock-X(D)
Unlock-X(B)
Unlock-X(E)
Lock-X(B)
Lock-X(E)
Unlock-X(H)
Lock-X(B)
Lock-X(G)
Unlock-X(D)
Unlock-X(E)
Unlock-X(B)
Unlock-X(G)

Advantages of Tree Protocol

Drawbacks of Tree Protocol