Binary Locks

This locking mechanism has two states for a data item:

  • Locked
  • Unlocked
Consider the following schedules:
Incorrect Locking

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.

Locking

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.