Timestamp based Concurrency Control (original) (raw)

Last Updated : 5 Jan, 2026

Timestamp-based concurrency control is a technique used in database management systems (DBMS) to ensure serializability of transactions without using locks. It uses timestamps to determine the order of transaction execution and ensures that conflicting operations follow a consistent order.

Each transaction T is assigned a unique timestamp TS(T) when it enters the system. This timestamp determines the transaction’s place in the execution order.

Timestamp Ordering Protocol

The Timestamp Ordering Protocol enforces that older transactions (with smaller timestamps) are given higher priority. This prevents conflicts and ensures the execution is serializable and deadlock-free.

**For example:

This means T1 is "older" than T2 and T1 should execute before T2 to maintain consistency.

Features of Timestamp Ordering Protocol:

**1. Transaction Priority:

**2. Early Conflict Management:

Unlike lock-based protocols, which manage conflicts during execution, timestamp-based protocols start managing conflicts as soon as a transaction is created.

**3. Ensuring Serializability:

The protocol ensures that the schedule of transactions is serializable. This means the transactions can be executed in an order that is logically equivalent to their timestamp order.

How Timestamp Ordering Works

Each **data item X in the database keeps two timestamps:

Basic Timestamp Ordering

The Basic TO Protocol works by comparing the timestamp of the current transaction with the timestamps on the data items it wants to **read/write:

Timestamp based Protocol

Precedence Graph for TS ordering

**Two Basic TO protocols are discussed below:

1. Whenever a Transaction **T issues a **R_item(X) operation, check the following conditions:

2. Whenever a Transaction **T issues a **W_item(X) operation, check the following conditions:

When conflicts are detected, the younger transaction is aborted and rolled back.

Strict Timestamp Ordering Protocol

The Strict Timestamp Ordering Protocol is an enhanced version that avoids cascading rollbacks by delaying operations until it's safe to execute them.

Key Features

Rules for Read Operation R_item(X):

T can read X only if:

Rules for Write Operation W_item(X):

T can write X only if:

If these conditions aren't met, the operation is delayed (not aborted immediately).

Advantages Disadvantages
**Conflict-Serializable: Maintains a correct execution order **Cascading Rollbacks (in Basic TO protocol)
**Deadlock-Free: No locks, so no circular waits **Starvation: Newer transactions may be delayed
**Simple Conflict Resolution: Uses timestamps only **High Overhead: Constantly updating R_TS/W_TS
**No Locking Needed: Avoids lock management complexity **Lower Throughput under high concurrency
**Predictable Execution: Operations follow a known order **Delayed Execution in Strict TO for consistency
  1. GATE | GATE CS 2010 | Question 20
  2. GATE | GATE-CS-2017 (Set 1) | Question 46
  3. GATE | GATE-IT-2004 | Question 21