Timestamp Ordering Protocol

  • The Timestamp Ordering Protocol is used to order the transactions based on their Timestamps. The order of transaction is nothing but the ascending order of the transaction creation.
  • The priority of the older transaction is higher that's why it executes first. To determine the timestamp of the transaction, this protocol uses system time or logical counter.
  • The lock-based protocol is used to manage the order between conflicting pairs among transactions at the execution time. But Timestamp based protocols start working as soon as a transaction is created.
  • Let's assume there are two transactions T1 and T2. Suppose the transaction T1 has entered the system at 007 times and transaction T2 has entered the system at 009 times. T1 has the higher priority, so it executes first as it is entered the system first.
  • The timestamp ordering protocol also maintains the timestamp of last 'read' and 'write' operation on a data.

Basic Timestamp ordering protocol works as follows:

1. Check the following condition whenever a transaction Ti issues a Read (X) operation:

  • If W_TS(X) >TS(Ti) then the operation is rejected.
  • If W_TS(X) <= TS(Ti) then the operation is executed.
  • Timestamps of all the data items are updated.

2. Check the following condition whenever a transaction Ti issues a Write(X) operation:

  • If TS(Ti) < R_TS(X) then the operation is rejected.
  • If TS(Ti) < W_TS(X) then the operation is rejected and Ti is rolled back otherwise the operation is executed.

Where,

TS(TI) denotes the timestamp of the transaction Ti.

R_TS(X) denotes the Read time-stamp of data-item X.

W_TS(X) denotes the Write time-stamp of data-item X.

Advantages and Disadvantages of TO protocol:

  • TO protocol ensures serializability since the precedence graph is as follows:

DBMS Timestamp Ordering Protocol
  • TS protocol ensures freedom from deadlock that means no transaction ever waits.
  • But the schedule may not be recoverable and may not even be cascade- free.





Contact US

Email:[email protected]

Time stamping Protocol
10/30