Concurrency Control Techniques Last Updated : 28 Dec, 2024 Comments Improve Suggest changes Like Article Like Report Concurrency control is provided in a database to:(i) enforce isolation among transactions.(ii) preserve database consistency through consistency preserving execution of transactions.(iii) resolve read-write and write-read conflicts.Various concurrency control techniques are:1. Two-phase locking Protocol2. Time stamp ordering Protocol3. Multi version concurrency control4. Validation concurrency control Concurrency control techniques in a Database Management System (DBMS) manage simultaneous operations without conflicts. Techniques like lock-based protocols, timestamp ordering, and optimistic concurrency control ensure that database transactions remain consistent, even when multiple transactions access the same data concurrently. These methods prevent problems such as deadlocks, dirty reads, and lost updates.These are briefly explained below. 1. Two-Phase Locking Protocol: Locking is an operation which secures: permission to read, OR permission to write a data item. Two phase locking is a process used to gain ownership of shared resources without creating the possibility of deadlock. The 3 activities taking place in the two phase update algorithm are:(i). Lock Acquisition(ii). Modification of Data(iii). Release Lock Two phase locking prevents deadlock from occurring in distributed systems by releasing all the resources it has acquired, if it is not possible to acquire all the resources required without waiting for another process to finish using a lock. This means that no process is ever in a state where it is holding some shared resources, and waiting for another process to release a shared resource which it requires. This means that deadlock cannot occur due to resource contention. A transaction in the Two Phase Locking Protocol can assume one of the 2 phases:(i) Growing Phase: In this phase a transaction can only acquire locks but cannot release any lock. The point when a transaction acquires all the locks it needs is called the Lock Point. (ii) Shrinking Phase: In this phase a transaction can only release locks but cannot acquire any. 2. Time Stamp Ordering Protocol: A timestamp is a tag that can be attached to any transaction or any data item, which denotes a specific time on which the transaction or the data item had been used in any way. A timestamp can be implemented in 2 ways. One is to directly assign the current value of the clock to the transaction or data item. The other is to attach the value of a logical counter that keeps increment as new timestamps are required. The timestamp of a data item can be of 2 types:(i) W-timestamp(X): This means the latest time when the data item X has been written into. (ii) R-timestamp(X): This means the latest time when the data item X has been read from. These 2 timestamps are updated each time a successful read/write operation is performed on the data item X. 3. Multiversion Concurrency Control: Multiversion schemes keep old versions of data item to increase concurrency. Multiversion 2 phase locking: Each successful write results in the creation of a new version of the data item written. Timestamps are used to label the versions. When a read(X) operation is issued, select an appropriate version of X based on the timestamp of the transaction. 4. Validation Concurrency Control: The optimistic approach is based on the assumption that the majority of the database operations do not conflict. The optimistic approach requires neither locking nor time stamping techniques. Instead, a transaction is executed without restrictions until it is committed. Using an optimistic approach, each transaction moves through 2 or 3 phases, referred to as read, validation and write.(i) During read phase, the transaction reads the database, executes the needed computations and makes the updates to a private copy of the database values. All update operations of the transactions are recorded in a temporary update file, which is not accessed by the remaining transactions. (ii) During the validation phase, the transaction is validated to ensure that the changes made will not affect the integrity and consistency of the database. If the validation test is positive, the transaction goes to a write phase. If the validation test is negative, he transaction is restarted and the changes are discarded. (iii) During the write phase, the changes are permanently applied to the database. Comment More infoAdvertise with us Next Article Concurrency Control Techniques L lemilxavier Follow Improve Article Tags : DBMS GATE CS DBMS-Transactions and Concurrency Control Similar Reads Concurrency Control in DBMS In a database management system (DBMS), allowing transactions to run concurrently has significant advantages, such as better system resource utilization and higher throughput. However, it is crucial that these transactions do not conflict with each other. The ultimate goal is to ensure that the data 7 min read Timestamp based Concurrency Control Timestamp-based concurrency control is a method used in database systems to ensure that transactions are executed safely and consistently without conflicts, even when multiple transactions are being processed simultaneously. This approach relies on timestamps to manage and coordinate the execution o 5 min read Types of Locks in Concurrency Control Commercial demands for ensuring smooth functionality and highly efficient run-time servers, make it highly prime for Database Designers to work out systems and code which cleverly avoid any kinds of inconsistencies in multi-user transactions, if not doubt the standard of memory management in read-he 11 min read What is Multi-Version Concurrency Control (MVCC) in DBMS? Multi-Version Concurrency Control (MVCC) is a database optimization method, that makes redundant copies of records to allow for safe concurrent reading and updating of data. DBMS reads and writes are not blocked by one another while using MVCC. A technique called concurrency control keeps concurrent 5 min read Concurrency problems in DBMS Transactions Concurrency control is an essential aspect of database management systems (DBMS) that ensures transactions can execute concurrently without interfering with each other. However, concurrency control can be challenging to implement, and without it, several problems can arise, affecting the consistency 4 min read Lock Based Concurrency Control Protocol in DBMS In a DBMS, lock-based concurrency control is a method used to manage how multiple transactions access the same data. This protocol ensures data consistency and integrity when multiple users interact with the database simultaneously.This method uses locks to manage access to data, ensuring transactio 7 min read Concurrency in Operating System Concurrency in operating systems refers to the capability of an OS to handle more than one task or process at the same time, thereby enhancing efficiency and responsiveness. It may be supported by multi-threading or multi-processing whereby more than one process or threads are executed simultaneousl 6 min read Graph Based Concurrency Control Protocol in DBMS In a Database Management System (DBMS), multiple transactions often run at the same time, which can lead to conflicts when they access the same data. Graph-Based Concurrency Control Protocol helps manage these conflicts and ensures that the database remains consistent.In this protocol, transactions 4 min read MOSS Concurrency Control Protocol (Distributed Locking in Database) This is a protocol which is used to control the concurrency in the Distributed database environment, Here we'll read about the rules and regulations that are required to keep in mind while applying MOSS Concurrency Control Protocol. MOSS Concurrency Control Protocol:- a) It is mainly used for handli 2 min read Two Phase Locking (2-PL) Concurrency Control Protocol | Set 3 In database systems, managing concurrent transactions is essential to maintain data consistency and ensure smooth operation. Two-Phase Locking (2PL) is a widely used concurrency control protocol that enforces serializability ensuring transactions are executed in a conflict-free manner. By dividing a 4 min read Like