edited by
929 views
9 votes
9 votes

Consider the following lock requests in the Table below. And note that:

  • $\mathrm{S}(\cdot)$ and $\mathrm{X}(\cdot)$ stand for 'shared lock' and 'exclusive lock', respectively.
  • $T_1, T_2, T_3, T_4$, and $T_5$ represent five transactions.
  • $L M$ represents a 'lock manager'.
  • Transactions will never release a granted lock.

$$
\begin{array}{|l||c|c|c|c|c|c|c|c|}
\hline \text{time} & t_1 & t_2 & t_3 & t_4 & t_5 & t_6 & t_7 & t_8 \\
\hline \hline T_1 & \mathrm{~S}(\mathrm{~A}) & & \mathrm{S}(\mathrm{B}) & & & & & \\
\hline T_2 & & \mathrm{X}(\mathrm{B}) & & & & & & \mathrm{X}(\mathrm{D}) \\
\hline T_3 & & & & \mathrm{~S}(\mathrm{C}) & \mathrm{X}(\mathrm{D}) & & \mathrm{X}(\mathrm{A}) & \\
\hline T_4 & & & & & & \mathrm{X}(\mathrm{C}) & & \\
\hline \hline L M & \mathrm{~g} & \mathrm{~g} & & & & & & \\
\hline
\end{array}
$$
To prevent deadlock, we use the lock manager $(L M)$ that adopts the Wound-Wait policy. We assume that in terms of priority: $T_1>T_2>T_3>T_4$. Here, $T_1>T_2 \text { because }\;T_1$ is older than $T_2$ (i.e., older transactions have higher priority). Determine whether the lock request is granted ('g'), blocked (' $b$ '), aborted ('a'), or already dead('-').

Select all that are correct.

  1. At t3: a
  2. At t6: b
  3. At t7: a
  4. At t8: -
edited by

1 Answer

8 votes
8 votes

Learn Wound-Wait & Wait-Die schemes for Deadlock Handling here: https://youtu.be/FzhbOG40ZH8 

For wound-wait deadlock prevention scheme:

  • At t3: g
  • At t4: g
  • At t5: g
  • At t6: b
  • At t7: b
  • At t8: -

For wait-die deadlock prevention scheme:

  • At t3: b
  • At t4: g
  • At t5: g
  • At t6: a
  • At t7: a
  • At t8: g

Watch this: https://youtu.be/FzhbOG40ZH8 


Explanation for time $t_3:$

At time $t_3,$ the request is being made by transaction $T_1$, not be $T_2.$ Request by $T_1$ goes to Lock Manager (LM), which aborts $T_2$ and grants request of $T_1.$ So, at $t_3, $ the request that is made, is granted. 

Note that for each "request" we need to determine whether that request is granted or not. The transaction making that request is aborted or not, blocked or not.

Note that: Block == Wait ; So, blocked state == waiting state. Blocked & Abort are different.  

edited by
Answer:

Related questions

2.3k
views
1 answers
2 votes
Arjun asked Feb 16
2,295 views
​​​​Which of the following statements about the Two Phase Locking ($2 \mathrm{PL}$) protocol is/are TRUE?$2 \mathrm{PL}$ permits only serializable schedulesWith $...
425
views
1 answers
6 votes
GO Classes asked Feb 5
425 views
Consider the following database relation: $\mathrm{R}=(\mathrm{SFLNGCRW} \mathrm{H})=(\mathrm{S}$ : SID, F: First Name, L: Last Name, N: Number of Units, G: GPA, C: Cours...