edited by
882 views
1 votes
1 votes

Consider the following schedule for transactions T1, T2 , these transactions have two phase locking:

T1: lock- S(A)
Read (A)
Lock –X (B)
Read (B)
B = A +B
Write (B)
Unlock (A)    
 Unlock(B)
T2 lock-X(A)
Lock- S(B)
write (A)
Read (B)
Unlock(A)
Unlock(B)

$$\begin{array}{||l|} \hline T1: & \text{Lock_S(A)} \\ & \text{Read (A)} \\ & \text{Lock _X (B)} \\ & \text{Read (B)} \\ & \text{B = A + B} \\ & \text{Write (B)} \\ & \text{Unlock (A)} \\ &  \text{Unlock(B)}  \\ \hline T2: & \text{Lock_X(A)} \\ & \text{Lock_S(B)} \\&\text{Write(A)} \\ & \text{Read(B)} \\ & \text{Unlock(A)} \\ & \text{Unlock(B)}  \\ \hline \end{array}$$

Which one of the statements below is the correct statement about T1 and T2?

  1. T1 and T2 are deadlock free
  2. T1 and T2 results in a deadlock
  3. T1 and T2 are serial schedule
  4. none of the above
edited by

2 Answers

Best answer
1 votes
1 votes

a) T1 and T2 are deadlock free

related thread:

https://www.facebook.com/groups/core.cs/permalink/1375317922500457/

selected by
1 votes
1 votes

As suggested by their names:-

  • Shared locks can coexist with other shared locks.
  • Exclusive locks can't coexist with any lock

Clearly, deadlock isn't a possibility here. Option A


The given schedule is not necessarily serial because suppose $T_2$ runs first; $T_2$ can execute up to the fifth line and after that when it unlocks A, $T_1$ can run it's first two lines.

Hence, not serial. 

Answer:

Related questions

1 votes
1 votes
1 answer
1
Bikram asked Nov 26, 2016
319 views
Consider the join of relation R with a relation S. If R has $m$ tuples and S has $n$ tuples, then the maximum and minimum sizes of the join, respectively, are __________....
0 votes
0 votes
1 answer
2
Bikram asked Nov 26, 2016
230 views
A functional dependency of the form x → y is trivial ify ⊆ xy ⊂ xx ⊆ yx ⊂ y
0 votes
0 votes
1 answer
3
Bikram asked Nov 26, 2016
300 views
What does the following Tuple Relational Calculus query produce?The expression σθ1 (E1 ⋈θ2 E2) is the same as: E1 ⋈θ1^ θ2 E2 (σθ1 E1) ∧ (σθ2 E2 ) E1 ⋈ θ...