in Databases
371 views
1 vote
1 vote

Given Problem :
 

S1 can be shown allowed under 2PL.
However, the solution that they have provided for S2 :


 

 

Seems wrong, as
 

 

So, is S2 allowed under 2PL, or the answer given is incorrect?

in Databases
371 views

3 Comments

@palashbehra5

Because precedence graph is acyclic. S2: TRUE. Allowed by 2PL ..

 

1. https://gateoverflow.in/235026/Test-series 

 

2. https://gateoverflow.in/243003/Made-easy-test-series

 

 

0
0

I went through the links sir, the questions are different, however, I observed https://gateoverflow.in/243003/Made-easy-test-series for this question, S2 has an acyclic precedence graph as well, but it is not allowed by 2PL protocol.

https://faculty.cc.gatech.edu/~jarulraj/courses/8803-s21/slides/13-two-phase-locking.pdf

There are potential schedules that are serializable but would not be allowed by 2PL. “, Slide No 23.
https://gateoverflow.in/42378/Conflict-serializable-and-2pl-schedule is an another good example of this.

2
2

You are right @palashbehra5 there are even some conflict serializable schedules that are not allowed under 2PL.

3
3

2 Answers

5 votes
5 votes
Best answer

This is how I solved and get S2 allowed under 2PL

selected by

3 Comments

I see, I was under the impression that before every read and writes, a lock is supposed to be acquired.
1
1
No , that is not the case .

This defination of 2pl locking from Korth –

15.1.3 The Two-Phase Locking Protocol One protocol that ensures serializability is the two-phase locking protocol. This protocol requires that each transaction issue lock and unlock requests in two phases

: 1. Growing phase. A transaction may obtain locks, but may not release any lock.

2. Shrinking phase. A transaction may release locks, but may not obtain any new locks.

Initially, a transaction is in the growing phase. The transaction acquires locks as needed. Once the transaction releases a lock, it enters the shrinking phase, and it can issue no more lock requests
2
2

Thanks @Isha_99 for such an elaborative explanation and @palashbehra5 for posting this question. Even I was under the same impression as your’s Palash. It helped me get more clarity. :)

4
4
0 votes
0 votes

In this video i Have shared a table which will classify which locking protocol is serializable, recoverable, deadlock free, rollback etc…

Hope it may help

Related questions