As we have discussed this earlier, now we will talk about the concurrency control.
Concurrency control in database management systems permits many users (assumed to be interactive) to access a database in a multi programmed environment while preserving the illusion that each user has sole access to the system.
Control is needed to coordinate concurrent accesses to a DBMS so that the overall correctness of the database is maintained.
The relative timing of the two transactions may have an impact on the state of the database at the end of the transactions. The end result may be an inconsistent database.
Once a transaction is committed, we cannot undo the changes made by the transactions by rolling back the transaction.
Only way to undo the effects of a committed transaction is to execute a compensating transaction.
The creating of a compensating transaction can be quite complex and so the task is left to the user and it is not handled by the DBMS.
The transaction must be in one of the following states:-
Active:- This is a initial state, the transaction stays in this state while it is executing
Partially committed:- The transaction is in this state when it has executed the final statement
Failed:- A transaction is in this state once the normal execution of the transaction cannot proceed.
Aborted:- A transaction is said to be aborted when the transaction has rolled back and the database is being restored to the consistent state prior to the start of the transaction
Committed:- a transaction is in this committed state once it has been successfully executed and the database is transformed in to a new consistent state.