0 0 votes In 2PL protocol if all exclusive locks are acquired by transaction in increasing order of their accesses then is the 2PL starvation free ? Databases databases transaction-and-concurrency test-series + – sumit chakraborty 2.2k views answer comment Share Follow Print See all 11 Comments 11 11 Comments reply Red_devil commented Nov 26, 2017 reply Follow flag I think 2PL does not prevent starvation.. 0 0 replyShare Ashwin Kulkarni commented Nov 26, 2017 reply Follow flag Infact 2PL leads to Deadlock. T1 T2 L_X(A) L_X(B) L_X(B) L_X(A) This leads to Deadlock hence infinite waiting. hence It is not starvation free. 1 1 replyShare sumit chakraborty commented Nov 26, 2017 reply Follow flag But the statement alludes to conservative 2PL which is deadlock free. According to the statement the transactions will be deadlock free. Will it be starvation free ? 0 0 replyShare Red_devil commented Nov 26, 2017 reply Follow flag @ sumit chakraborty strict 2PL is not deadlock free. 1 1 replyShare Ashwin Kulkarni commented Nov 26, 2017 reply Follow flag @ sumit chakraborty I have given example of basic 2PL. Still if you are considering conservative 2PL then it surely leads to starvation. because if all locks are acquired by T1 initially then t2 has to starve until T1 unlocks. and if some operation of T1 is taking too much time then T2 will surely starve. 1 1 replyShare Red_devil commented Nov 26, 2017 reply Follow flag @ Ashwin Kulkarni i don't think your example comes under starvation problem..because we assume that no process wants lo be in critical section or want to use a resource infinitely. 0 0 replyShare Ashwin Kulkarni commented Nov 26, 2017 reply Follow flag @ Red_devil Deadlock is an infinite form of starvation. Hence I think in my example there is a deadlock means infinite waiting hence both processes will starve forever. 0 0 replyShare Red_devil commented Nov 26, 2017 reply Follow flag @Ashwin Kulkarni your explanation is right for strict 2PL..let us talk about conservative 2PL in which there is no deadlock.. now explain how there is starvation. 0 0 replyShare Ashwin Kulkarni commented Nov 26, 2017 reply Follow flag i have already explained conservative 2PL above but let's take this in depth. Let's say all locks are acquired by T1 initially, then T2 has to starve until T1 unlocks. and if some operation of T1 is taking too much time then T2 will surely starve. T1 T2 L_X(A) L_X(B) Execution A Now here B is taking too much time, Hence T2 has to wait until execution of B Then only T2 can aquire its locks and start its execution. execution of B Hence here Though lock on B in T1 is taken initially but B is taking too much time in T1 hence T2 has to starve untill T1 unlocks B. Because In T2 also X(A) and X(B) should be acquire at start of its execution 0 0 replyShare Red_devil commented Nov 26, 2017 reply Follow flag @Ashwin Kulkarni so according to this Peterson's solution in OS should be not starvation free because we can't preempt any process while it is executing. 0 0 replyShare Ashwin Kulkarni commented Nov 26, 2017 reply Follow flag You're talking about priority inversion problem in Peterson's solution. 0 0 replyShare Please log in or register to add a comment.
Best answer 2 2 votes It might help https://gateoverflow.in/102854/2pl-protocol Arpit Dhuriya answered Nov 26, 2017 • selected Nov 26, 2017 by sumit chakraborty Arpit Dhuriya comment Share Follow 0 reply Please log in or register to add a comment.