Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

GATE | Gate IT 2007 | Question 64

  • Last Updated : 28 Jun, 2021

Consider the following two transactions : T1 and T2.
2007_66
Which of the following schemes, using shared and exclusive locks, satisfy the requirements for strict two phase locking for the above transactions?
2007_66_1

2007_66_2
(A) A
(B) B
(C) C
(D) D


Answer: (C)

Explanation:  

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

Shared locks are used for Read,exclusive locks are used for Write data. one exclusive lock can not take other exclusive lock which is already taken by other schedule as it will lead to deadlock. Requirements to follow Strict 2PL:
1. Exclusive locks should be released after the commit (Releasing exclusive lock after commit restrict the deadlock condition. i.e. we cannot get lock on item were exclusive lock already taken.
2. No Locking can be done after the first Unlock and vice versa.

option (A): Incorrect because to write B,S1 needs exclusive lock on B and to write A,S2 needs exclusive Lock on A. that’s why it is incorrect.
option (B): Incorrect because one exclusive lock cannot take other’s Exclusive Lock. here, S1 has taken exclusive lock on item A, S2 has taken exclusive lock on item B so now S1 can’t take exclusive lock on item B and S2 can’t take exclusive lock on item A. that’s why it is incorrect.
option (C): Correct as it is following all the three requirement for strict 2PL. Here,schedule S1 releases exclusive lock on B after commit and schedule S2 releases exclusive lock on A after commit.(condition 1 satisfied)
option(D): incorrect as according to condition 1,Exclusive locks should be released after the commit. here,schedule S1 releases exclusive lock on B before commit and schedule S2 releases exclusive lock on A before commit. Hence it is incorrect.

This solution is contributed by Nitika Bansal .

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!