This locking mechanism has two states for a data item:
The above locking method will not solve the problem of concurrent transactions. So locking should be done with some logic in order to make sure that locking results in no concurrency related problem.
Thus, the locking as above when we obtain all the locks at the beginning of the transaction and release them at the end ensures that transactions are executed with no concurrency related problem. However, such a scheme limits the concurrency.