1. Conservative 2-PL :
- It is also known as Static 2-PL.
- This protocol requires the transaction to lock all the items it access before the transaction begins execution by pre-declaring its read-set and write-set.
- If any of the pre-declared items needed cannot be locked, the transaction does not lock any of the items, instead, it waits until all the items are available for locking.
2. Strict 2-PL :
- The most popular variation of 2-PL is Strict 2-PL.
- It is a lighter version of Rigorous 2-PL.
- This requires that in addition to the lock being 2-Phase all Exclusive(X) Locks held by the transaction be released until after the Transaction Commits.
- Transactions are allowed to release Shared locks before it Commits.
Difference between Conservative and Strict 2-PL :
|S.No.||Conservative 2-PL||Strict 2-PL|
|1.||In Conservative 2-PL, A transaction has to acquire locks on all the data items it requires before the transaction begins it execution.||In Strict 2-PL, A transaction can acquire locks on data items whenever it requires (only in growing phase) during its execution.|
|2.||It does not have growing phase.||It has growing phase.|
|3.||It has shrinking phase.||It has partial shrinking phase.|
|4.||It ensures that the schedule generated would be Serializable and Deadlock-Free.||It ensures that the schedule generated would be Serializable, Recoverable and Cascadeless.|
|5.||It does not ensures Recoverable and Cascadeless schedule.||It does not ensures Deadlock-Free schedule.|
|6.||It does not ensure Strict Schedule.||It ensures that the schedule generated would be Strict.|
|7.||It is less popular as compared to Strict 2-PL.||It is the most popular variation of 2-PL.|
|8.||It is not used in practise.||It is the most popular variation of 2-PL.|
|9.||In Conservative 2-PL, a transaction can read a value of uncommitted transaction.||In Strict 2-PL, a transaction only reads value of committed transaction.|