We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
Concurrency Control in DBMS
Concurrency Control in DBMS is a procedure of managing simultaneous transactions by ensuring
their ACID properties and serializability. Concurrency Control ensures the simultaneous execution of multiple transactions or manipulation of data by several processes or user without resulting in data inconsistency.
What is Concurrent Execution?
• In a multi-user system, multiple users can access and use the same database at one time, which is known as the concurrent execution of the database. That means the same database is executed simultaneously on a multi-user system by different users. • While working on the database transactions, there occurs the requirement of using the database by multiple users for performing different operations, and in that case, concurrent execution of the database is performed. • The thing is that the simultaneous execution that is performed should be done in an interleaved manner, and no operation should affect the other executing operations, thus maintaining the consistency of the database. Thus, on making the concurrent execution of the transaction operations, there occur several challenging problems that need to be solved.
Problems with Concurrent Execution
In a database transaction, the two main operations are READ and WRITE operations. So, there is a need to manage these two operations in the concurrent execution of the transactions as if these operations are not performed in an interleaved manner, and the data may become inconsistent. So, the following problems occur with the Concurrent Execution of the operations. Lost Update Problems (W - W Conflict) The problem occurs when two different database transactions perform the read/write operations on the same database items in an interleaved manner (i.e., concurrent execution) that makes the values of the items incorrect hence making the database inconsistent. Dirty Read Problems (W-R Conflict) The dirty read problem occurs when one transaction updates an item of the database, and somehow the transaction fails, and before the data gets rollback, the updated database item is accessed by another transaction. There comes the Read-Write Conflict between both transactions. Unrepeatable Read Problem (W-R Conflict) Also known as Inconsistent Retrievals Problem that occurs when in a transaction, two different values are read for the same database item. Concurrency Control Concurrency Control is the working concept that is required for controlling and managing the concurrent execution of database operations and thus avoiding the inconsistencies in the database. Thus, for maintaining the concurrency of the database, we have the concurrency control protocols. Concurrency Control Protocols The concurrency control protocols ensure the atomicity, consistency, isolation, durability and serializability of the concurrent execution of the database transactions. Therefore, these protocols are categorized as: o Lock Based Concurrency Control Protocol o Time Stamp Concurrency Control Protocol o Validation Based Concurrency Control Protocol Timestamp Ordering Protocol According to this protocol, every transaction has a timestamp attached to it. The timestamp is based on the time in which the transaction is entered into the system. There is read and write timestamps associated with every transaction which consists of the time at which the latest read and write operations are performed respectively. o 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. o 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. o Timestamp based protocols start working as soon as a transaction is created. o The timestamp ordering protocol also maintains the timestamp of last 'read' and 'write' operation on a data. Working of Timestamp ordering protocol: 1. Check the following condition whenever a transaction Ti issues a Read (X) operation. o If W_TS(X) >TS(Ti) then the operation is rejected. o If W_TS(X) <= TS(Ti) then the operation is executed. o Timestamps of all the data items are updated. 2. Check the following condition whenever a transaction Ti issues a Write(X) operation. o If TS(Ti) < R_TS(X) then the operation is rejected. o If TS(Ti) < W_TS(X) then the operation is rejected and Ti is rolled back otherwise the operation is executed. Here, 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.