Explain Two phase locking protocol
A transaction is consider as to follow the two-phase locking protocol if all locking operations precede the first unlock operation in the transaction. Such type of transaction can be divided into two phases: and expanding or growing (first) phase, throughout which new locks on items can be acquired but none can be released; and a shrinking (second) phase, throughout which existing locks can be released but no new locks can be obtained. This two-phase protocol can make sure the serializability because all the data items needed by a transaction will be locked at the starting of the transaction and if other transaction needs to use those data items then it has to wait till they become unlocked.