Explain about the Time stamp ordering protocol in DBMS

DBMSDatabaseBig Data Analytics

The timestamp-ordering protocol ensures serializability among transactions in their conflicting read and write operations. This is the responsibility of the protocol system that the conflicting pair of tasks should be executed according to the timestamp values of the transactions.

A conflict occurs when an older transaction tries to read/write a value already read or written by a younger transaction. Read or write proceeds only if the last update on that data item was carried out by an older transaction.

Otherwise, the transaction requesting read/write is restarted and gives a new timestamp. Here no locks are used so no deadlock.

  • The timestamp of transaction Ti is denoted as TS(Ti).

  • Read time-stamp of data-item X is denoted by R-timestamp(X).

  • Write time-stamp of data-item X is denoted by W-timestamp(X).

These timestamps are updated after a successful read/write operation on data item X.

Older transactions get priority over younger transactions in the event of conflict operation. Conflict is resolved by rolling back and restarting transactions.

Rules for a transaction

To ensure serializability following rules are used −

Rule 1 − If a transaction Ti issues a read(X) operation.

If TS(Ti) < W-timestamp(X)

Operation rejected.

If TS(Ti) >= W-timestamp(X)

Operation executed.

All data-item timestamps updated.

Rule 2 − If a transaction Ti issues a write(X) operation.

If TS(Ti) < R-timestamp(X)

Operation rejected.

If TS(Ti) < W-timestamp(X)

Operation rejected and Ti rolled back.

Otherwise, the operation is executed.

Thomas' Write Rule

This rule states if TS(Ti) < W-timestamp(X), then the operation is rejected and Ti is rolled back.

Time-stamp ordering rules can be modified to make the schedule view serializable.

Instead of making Ti rolled back, the 'write' operation itself is ignored.

EFFECT − Thomas Write Rule allows such operations and is a modification on the Basic Timestamp Ordering protocol. In Thomas Write Rule users ignore outdated writes.


S: f1(X) W2(X) W1(X)

Check whether timestamp ordering protocol allows schedule S.


For f1(X) : TS(Ti) <WTS(X) i.e TS(T1)<WTS(X)
   3<0 (FALSE)

GOTO else and perform write operation W2(X) AND WTS(X)=4

For W1(X): TS(Ti)<RTS(X) i.e TS(T1)<RTS(X)
      3<3 (FALSE)
      3<4 (TRUE)
Updated on 06-Jul-2021 14:59:02