in Databases
145 views
1 vote
1 vote

Consider the below-given statements about the transactions where
L-Si(X) indicates that transaction Ti acquires a shared lock on X.
L-Xi(X) indicates that transaction Ti acquires an exclusive lock on X.
Ui indicates that transaction Ti releases its lock on X.
I. The schedule S: 
    L-S1(X); R1(X); L-X1(Y);U1(X); L-S2(X); W1(Y); C1;U1(Y); L-X2(Y); W2(Y); R2(X); U2(X); C2; U2(Y); 

Is generated by both 2PL and strict-2PL.

 

in Databases
145 views

1 Answer

0 votes
0 votes

I think this will get generated by both 2PL and strict 2PL.

    T1                T2

--------------------------

L-S1(X);                                        <----- Here T1 acquires shared lock on X

R1(X);

L-X1(Y);                                        <----- Here T1 acquires exclusive lock on Y

U1(X);                                           <---- Here T1 releases shared lock on X

                      L-S2(X);                  <----- Here T2 acquires shared lock on X

W1(Y);

C1;                                                <----- Here T1 commits                           

U1(Y);                                            <----- Here T1 releases exclusive lock on Y    

                      L-X2(Y);                   <----- Here T2 acquires exclusive lock on Y

                       W2(Y);

                       R2(X);

                       U2(X);                     <----- Here T2 releases shared lock on X

                         C2;                        <----- Here T2 commits

                       U2(Y);                     <----- Here T2 releases exclusive lock on Y

No transaction acquires any lock after the shrinking stage starts for that transaction. So it follows 2PL. And we can observe none of the transactions release its exclusive lock before committing. So it follows strict 2PL.

Related questions