There are several methods for concurrency control in database management systems (DBMS):
- Locking: This method allows a transaction to lock a data item so that no other transaction can access it until the lock is released. There are two types of locks: shared locks and exclusive locks. Shared locks allow multiple transactions to read a data item simultaneously, while exclusive locks allow only a single transaction to access the data item.
- Timestamp ordering: This method assigns a unique timestamp to each transaction and executes them in the order of their timestamps. This ensures that transactions are executed in the order in which they were initiated, thereby avoiding conflicts.
- Optimistic concurrency control: This method allows multiple transactions to access and modify data items simultaneously. However, it checks for conflicts only during the commit phase, and if any conflicts are found, the conflicting transactions are rolled back and re-executed.
- Serializability: This method ensures that the execution of transactions appears as if they were executed one after the other, in some serial order. This is achieved by executing transactions in a serializable schedule, which is a sequence of operations that preserves the consistency of the database.
- Conflict serializability: This method is similar to serializability, but it only checks for conflicts between transactions and does not guarantee serial execution.