recategorized by
956 views
1 votes
1 votes

Consider the following interleaved schedule with two transactions T1 and T2. The Two-Phase Locking Protocol is followed for achieving concurrency control. Which of the following statements is true with respect to the given schedule?

  1. The schedule is equivalent to the serial schedule T2 ; T1
  2. The schedule is equivalent to the serial schedule T1 ; T2
  3. The schedule results in a deadlock
  4. The schedule is not permitted as per Two Phase Locking Protocol
recategorized by

1 Answer

1 votes
1 votes
$\begin{array}{|c|c|c|} \hline \text{Line Number} & T1 & T2 \\ \hline 1 & S(A) & \\ \hline 2 & R(A) & \\ \hline 3 & & S(A) \\ \hline 4 & & R(A) \\ \hline 5 & & X(B) \\ \hline 6 & & R(B) \\ \hline 7 & & W(B) \\ \hline 8 & & \text{Commit} \\ \hline 9 & X(C) & \\ \hline 10 & R(C) & \\ \hline 11 & W(C) & \\ \hline 12 & \text{Commit} & \\ \hline \end{array}$
Explanation: The schedule starts off by executing two statements of transaction T1, in line numbers $1$ and $2$. T1 obtains a shared lock on object A and reads object. At this point T1 is suspended and control is transferred to T2. Then, in lines $3$ to $8$, transaction T2 obtains a shared lock on object A, reads object A, obtains an exclusive lock on object B, reads and writes object B, and finally commits. At this point T2 has completed execution before T1, and all the locks held by it are released. T1 resumes its execution in line number $9$, it obtains an exclusive lock on object C, reads and writes C, and then commits. T1 has also completed its execution. This schedule has reduced to the serial schedule T2 followed by T1.
Answer:

Related questions

3 votes
3 votes
2 answers
3
Applied Course asked Jan 16, 2019
938 views
Consider the following Relation $\text{employee}$:$$\begin{array}{|l|l|l|} \hline \text{eno} & \text{ename} & \text{manager} \\ \hline 1 & \text{satish} & \text{rajeev} \...
1 votes
1 votes
1 answer
4
Applied Course asked Jan 16, 2019
489 views
Consider the relation Parts $\text{(Partno, SupplierID, Partname, Model)}$, with $\text{{Partno, SupplierID}}$ as the primary key. Suppose the following functional depend...