0% found this document useful (0 votes)
11 views

Timestamp Based Concurrency Control

Timestamp Based Concurrency Control is a method for managing concurrent transactions in databases using unique timestamps assigned to each transaction. The Timestamp Ordering Protocol ensures that transactions are executed in the order of their timestamps to maintain serializability, with specific rules for read and write operations to prevent violations of this order. Variations like Strict Timestamp Ordering enhance the protocol by delaying operations until prior transactions have completed, ensuring stricter conflict serializability.

Uploaded by

Tejas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Timestamp Based Concurrency Control

Timestamp Based Concurrency Control is a method for managing concurrent transactions in databases using unique timestamps assigned to each transaction. The Timestamp Ordering Protocol ensures that transactions are executed in the order of their timestamps to maintain serializability, with specific rules for read and write operations to prevent violations of this order. Variations like Strict Timestamp Ordering enhance the protocol by delaying operations until prior transactions have completed, ensuring stricter conflict serializability.

Uploaded by

Tejas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Timestamp Based Concurrency Control

Concurrency Control can be implemented in different ways. One way to implement it is by using Locks. Now, lets
discuss about Time Stamp Ordering Protocol.
As earlier introduced, Timestamp is a unique identifier created by the DBMS to identify a transaction. They are
usually assigned in the order in which they are submitted to the system. Refer to the timestamp of a
transaction T as TS(T). For basics of Timestamp you may refer here.
Timestamp Ordering Protocol –
The main idea for this protocol is to order the transactions based on their Timestamps. A schedule in which the
transactions participate is then serializable and the only equivalent serial schedule permitted has the transactions in
the order of their Timestamp Values. Stating simply, the schedule is equivalent to the particular Serial
Order corresponding to the order of the Transaction timestamps. Algorithm must ensure that, for each items
accessed by Conflicting Operations in the schedule, the order in which the item is accessed does not violate the
ordering. To ensure this, use two Timestamp Values relating to each database item X.
• W_TS(X) is the largest timestamp of any transaction that executed write(X) successfully.
• R_TS(X) is the largest timestamp of any transaction that executed read(X) successfully.

From <https://www.geeksforgeeks.org/timestamp-based-concurrency-control/>

Basic Timestamp Ordering –

Every transaction is issued a timestamp based on when it enters the system. Suppose, if an old transaction T i has
timestamp TS(Ti), a new transaction Tj is assigned timestamp TS(Tj) such that TS(Ti) < TS(Tj).The protocol manages
concurrent execution such that the timestamps determine the serializability order. The timestamp ordering protocol
ensures that any conflicting read and write operations are executed in timestamp order. Whenever some
Transaction T tries to issue a R_item(X) or a W_item(X), the Basic TO algorithm compares the timestamp
of T with R_TS(X) & W_TS(X) to ensure that the Timestamp order is not violated. This describe the Basic TO
protocol in following two cases.

From <https://www.geeksforgeeks.org/timestamp-based-concurrency-control/>

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.

From <https://www.javatpoint.com/dbms-timestamp-ordering-protocol>

Advantages and Disadvantages of Basic TO protocol:


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

• 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.

From <https://www.javatpoint.com/dbms-timestamp-ordering-protocol>

Strict Timestamp Ordering –


A variation of Basic TO is called Strict TO ensures that the schedules are both Strict and Conflict Serializable. In this
variation, a Transaction T that issues a R_item(X) or W_item(X) such that TS(T) > W_TS(X) has its read or write
operation delayed until the Transaction T‘ that wrote the values of X has committed or aborted.

From <https://www.geeksforgeeks.org/timestamp-based-concurrency-control/>

RDBMS Page 1
RDBMS Page 2

You might also like