935 views
1 votes
1 votes
T1 T2
read_lock(Y)  
read(Y)  
  read_lock(X)
  read(X)
write_lock(X)  
write(X)  
  write_lock(Y)
  write(Y)
unlock(X)  
unlock(Y)  
  unlock(X)
  unlock(Y)

Is above shedule:
1 Conflict serializable

2 Incurs Deadlock and not conflict serializable

2 Incurs Deadlock but conflict serializable

2 Answers

0 votes
0 votes
as the schedule is allowed under 2PL implies it is Conflict Serializable.

as all locks are granted at each step (i.e if T1 has a shared lock on any data item Y then other transaction can apply exclusive lock on that data item) so it is deadlock free
0 votes
0 votes

Answer: Incurs Deadlock but conflict serializable

We can observe that in T1 shared lock is applied on Y, again T2 is trying to access Y before shrinking phase. Similarly T2 is share locking X, and T1 is trying to access X before the shrinking phase. So deadlock is happening here. 

3 points need to be noted:-

1. Cascading rollback can occur in 2PL.

2. Deadlock may occur in 2PL.

3. Serializability is guaranteed in 2PL.

Serializability is mainly an issue of handling write operation. Because any inconsistency may only be created by write operation. Multiple reads on a database item can happen parallely.
2-Phase Locking protocol restricts this unwanted read/write by applying exclusive lock. Moreover, when there is an exclusive lock on an item it will only be released in shrinking phase. Due to this restriction there is no chance of getting any inconsistent state.

Related questions

1 votes
1 votes
4 answers
1
samarpita asked Nov 13, 2021
589 views
every strict recoverable schedule is conflict serializable..if not then why?
0 votes
0 votes
2 answers
2
2 votes
2 votes
0 answers
3
vinay chauhan asked Jan 18, 2019
576 views
Is different 2 phase locking a subset of each other? For example, if the schedule is Strict 2PL then it will also be simple 2PL.Something like a 2PL is a subset of Strict...
0 votes
0 votes
1 answer
4
jatin khachane 1 asked Jan 16, 2019
1,317 views
Is the following schedule conflict serializableT1T2T3W(X) commit R(X) W(X) R(X) W(X) commit W(X) commit