2,358 views
2 votes
2 votes

Which of the following schedules are allowed by Strict 2PL protocol?

  1.   r1(A); r2(B); r3(C); w1(B); C1; w2(C); C2; w3(D); C3
  2.   r1(A); r2(B); r3(C); w1(B); w2(C); w3(A); C1; C2; C3
  3.   r1(A); r2(B); r3(C); r1(B); r2(C); r3(D); C3; w1(C); C1; w2(D); C2
  4.   r1(A); r2(B); r3(C); w1(B); C1; w2(C); C2; w3(D); C3

1 Answer

2 votes
2 votes

here, S(*) = shared lock and X(*) = Exclusive lock

For 1 and 4 (both are same)

T1 T2 T3
S(A)
R(A)
   
  S(B)
R(B)
 
    S(C)
R(C)
X(D)
U(C)
  X(C)
U(B)
 
X(B)
W(B)
commit
U(B)
U(A)
   
  W(C)
commit
U(C)
 
    W(D)
commit
U(D)

For 3rd schedule

T1 T2 T3
S(A)
R(A)
   
  S(B)
R(B)
 
    S(C)
R(C)
S(B)
R(B)
   
  S(C)
R(C)
 
    S(D)
R(D)
commit
U(C)
U(D)
  X(D)
U(C)
 
X(C)
W(C)
commit
U(C)
U(B)
U(A)
   
  W(D)
commit
U(D)
U(B)