GATEverse
← GATE CSE 2012

Q27

MCQ2 marks, −0.67

Consider the following transactions with data items PP and QQ initialized to zero:

T1read (P);read (Q);if P = 0 then Q := Q + 1; write (Q)T2read (Q);read (P);if Q = 0 then P := P + 1;write (P){\begin{array}{|c|l|r|c|}\hline \textbf{$T_1$}& \text{read (P);}\\ & \text{read (Q);} \\ & \text{if P = 0 then Q := Q + 1; }\\ & \text{write (Q)} \\ \hline \textbf{$T_2$}& \text{read (Q);}\\& \text{read (P);} \\ & \text{if Q = 0 then P := P + 1;} \\ & \text{write (P)} \\ \hline \end{array}}

Any non-serial interleaving of T1 and T2 for concurrent execution leads to

Sign in to save attempts.

Loading…