Gate2017 cs Q53

0. In a database system, unique time stamps are assigned to each transaction using Lamport’s logical clock. Let TS(T1) and TS(T2) be the timestamps of transactions T1 and T2 respectively. Besides, T1 holds a lock on the resource R, and T2 has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.
if TS(T2) < TS(T1) then
T1 is killed
else T2 waits.
Assume any transactions that is not killed terminates eventually. Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?

  • Option : A
  • Explanation :
    Given,
    if TS(T2) <TS(T1) then
    T1 is killed
    else T2 waits.
    - T1 holds a lock on the resource R
    - T2 has requested a conflicting lock on the same resource R
    According to algo, TS(T2) <TS(T1) then T1 is killed else T2 will wait. So in both cases neither deadlock will happen nor starvation.
    Therefore, option A is correct
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *