Concurrency Control is concerned with the interleaved execution of several transactions. In the following article, we will define transaction and schedules in Concurrency Control.
Transaction in Concurrency Control
A set of logically related operations is basically the transaction. The main operations of a transaction are , read, write, commit and rollback.
Basic properties of a transaction are,
This means that the complete transaction either occurs all at once or does not occur at all. There is no middle ground, which means that transactions do not take place in stages. Atomicity is frequently referred to as the ‘all or nothing rule.’
This means that integrity requirements is to ensure that the database is consistent before and after the transaction. It relates to the accuracy of a database.
This attribute ensures that numerous transactions can occur concurrently without causing the database state to become inconsistent. This assures that running transactions concurrently results in a state that is similar to doing them sequentially in some order.
This attribute ensures that once the transaction has completed execution, the database updates and modifications are there in the disk. Also they persist even if the system fails.
Schedule in Concurrency Control
A schedule is a collection of operations, derived from one or more transactions. There are two kinds of schedules.
Serial Schedule: It is one in which one transaction entirely runs before starting another. A serial timetable is always reliable. A serial schedule has a low throughput and uses less resources.
Concurrent Schedule: It is one in which the operations of one transaction are interleaved with the operations of other transactions in the schedule. However, concurrency can lead to database inconsistency.
Why Use Concurrency Control Method
- Isolation through reciprocal exclusion of contradictory transactions.
- In order to resolve read-write and write-write conflict concerns.
- To maintain database consistency by constantly preserving execution impediments.
- The system must manage the interplay of the concurrent transactions. Concurrent-control techniques are useful to achieve this control.
- Concurrency control contributes to serializability.