▪︎Concurrency control is the procedure in DBMS for managing simultaneous operations without conflicting with each another.
▪︎Concurrent access is quite easy if all users are just reading data.
▪︎There is no way they can interfere with one another.
▪︎Though for any practical database, would have a mix of reading and WRITE operations and hence the concurrency is a challenge.
▪︎Concurrency control is used to address such conflicts which mostly occur with a multi-user system.
▪︎It helps us to make sure that database transactions are performed concurrently without violating the data integrity of respective databases.
▪︎Therefore,It is a most important element for the proper functioning of a system where two or multiple database transactions that require access to the same data, are executed simultaneously.
USES:
▪︎The system needs to control the interaction among the concurrent transactions. This control is achieved using concurrent-control schemes.
▪︎Concurrency control helps to ensure serializability.
▪︎To resolve read-write and write-write conflict issues.
Concurrency Control protocols:
Different concurrency control protocols offer different benefits between the amount of concurrency they allow and the amount of overhead that they impose.
1)Lock-Based Protocols
2)Two Phase
3)Timestamp-Based Protocols
4)Validation-Based Protocols
▪︎The lock could be Shared (S) or Exclusive (X)
▪︎Two-Phase locking protocol which is also known as a 2PL protocol needs transaction should acquire a lock after it releases one of its locks.
▪︎ It has 2 phases growing and shrinking.
▪︎The timestamp-based algorithm uses a timestamp to serialize the execution of concurrent transactions.
▪︎
The protocol uses the System Time or Logical Count as a Timestamp.
Characteristics of good concurrency protocol:
▪︎It must enforce some constraints on the structure of atomic actions of transactions.
▪︎It allows the parallel execution of transactions to achieve maximum concurrency.
ADVANTAGES:
▪︎Using Concurrency, many Transactions executes simultaneously due to which waiting time decreases and also increase in resource utilization.
▪︎By having concurrency control we can avoid inconsistent data .
DISADVANTAGES:
▪︎If locking is not available and several users access a database concurrently.
▪︎problems may occur if their transactions use the same data at the same time