As we know, concurrency control play a vital role in many computer science fields, especially in operating systems, multiprocessors, and databases. A fine concurrent control strategy can assure a correct result when multi processes access the same data concurrency.
If every processes execute serially, we do not need such a method to control multi-access at the same time, but without the overlap to reduce execution time as well. If we can not cooperate every processes.We have to face A-B-A problem, the lost update problem, the dirty read problem and etc.
There are three main categories of concurrency control mechanisms:
Optimistic: Assume every transaction is a good one(without blocking). If this transaction will bring conflicts, aborting this, and then re-executing this transaction. If there exists lots of abort, it is easy to deduce that the overhead for re-executing is huge.
Pessimistic: Blocking transaction, unless we make sure any operations of this transaction cannot occur abort.
Semi-optimistic
There are four major methods to do concurrency control, and these methods may overlap or be combined in some cases:
- Locking (e.g., Two-phase locking - 2PL) - Controlling access to data by locks assigned to the data. Access of a transaction to a data item (database object) locked by another transaction may be blocked (depending on lock type and access operation type) until lock release.
- Serialization graph checking (also called Serializability, or Conflict, or Precedence graph checking) - Checking for cycles in the schedule’s graph and breaking them by aborts.
- Timestamp ordering (TO) - Assigning timestamps to transactions, and controlling or checking access to data by timestamp order.
- Commitment ordering (or Commit ordering; CO) - Controlling or checking transactions’ chronological order of commit events to be compatible with their respective precedence order.
Besides, we can use three methods to support methods above includes:
- Multiversion concurrency control (MVCC) - Increasing concurrency and performance by generating a new version of a database object each time the object is written, and allowing transactions’ read operations of several last relevant versions (of each object) depending on scheduling method.
- Index concurrency control - Synchronizing access operations to indexes, rather than to user data. Specialized methods provide substantial performance gains.
- Private workspace model (Deferred update) - Each transaction maintains a private workspace for its accessed data, and its changed data become visible outside the transaction only upon its commit (e.g., Weikum and Vossen 2001). This model provides a different concurrency control behavior with benefits in many cases.
In conclusion, CC is a important technology to improve ACID attributes in transaction. In different application situations, we must apply different concurrency control method to avoid incorrect status of system.