1. Conservative 2-PL :
- It is also called 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. Rigorous 2-PL :
- This requires that in addition to the lock being 2-Phase all Exclusive(X) and Shared(S) Locks held by the transaction be released until after the Transaction Commits.
- Rigorous is more restrictive than Strict 2-PL.
- The implementation of Rigorous 2-PL is easy.
Difference between Conservative and Rigorous 2-PL :
|S.No.||Conservative 2-PL||Rigorous 2-PL|
|1.||A transaction has to acquire locks on all the data items it requires before the transaction begins it execution.||A transaction can acquire locks on data items whenever it requires (only in growing phase) during its execution.|
|2.||It does not have a growing phase.||It has a growing phase.|
|3.||It has a shrinking phase.||It does not have a 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 not used in practise as its difficult to implement.||It is easy to implement but a lighter version of it (i.e Strict 2-PL) is used in practise.|
|8.||In Conservative 2-PL, a transaction can read a value of uncommitted transaction.||In Rigorous 2-PL, a transaction only reads value of committed transaction.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Categories of Two Phase Locking (Strict, Rigorous & Conservative)
- Difference and Similarities between PHP and C
- Difference between Stop and Wait, GoBackN and Selective Repeat
- Difference between Stop and Wait protocol and Sliding Window protocol
- Similarities and Difference between Java and C++
- Difference between Yaacomo and and XAP
- Difference between VoIP and and POTS
- Difference between ++*p, *p++ and *++p
- Difference Between DOS and Windows
- Difference between User Level thread and Kernel Level thread
- What’s difference between The Internet and The Web ?
- Difference between Priority Inversion and Priority Inheritance
- What’s difference between Linux and Android ?
- What’s difference between header files "stdio.h" and "stdlib.h" ?
- Difference between HTML and HTTP
- Difference between http:// and https://
- What's difference between MMU and MPU?
- What's difference between Microcontroller (µC) and Microprocessor (µP)?
- What's the difference between Scripting and Programming Languages?
- What’s difference between “array” and “&array” for “int array” ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.