Multiple choice

Consider the following transactions with data items P and Q initialized to zero: T1: read (P); read (Q); if P = 0 them Q: = Q + 1; write (Q). T2: read (Q); read (P) if Q = 0 then P: = P + 1; write (P). Any non - serial interleaving of T1 and T2 for concurrent execution leads to

  1. a serializable schedule

  2. a schedule that is not conflict serializable

  3. a conflict seriallzable schedule

  4. a schedule for which precedence graph cannot be drawn

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Let S be a non-serial schedule, without loss of generality assume that T1 has started earlier than T2. The first instruction of T1 is read(P) and the last instruction of T2 is write(P), so the precedence graph for S has an edge from T1 to T2, now since S is a non-serial schedule the first instruction of T2 (read(Q)) should be executed before last instruction of T1 (write(Q)) and since read and write are conflicting operations, the precedence graph for S also contains an edge from T2 to T1, So we will have a cycle in the precedence graph which implies that any non serial schedule with T1 as the earliest transaction will not be conflict serializable. In a similar way we can show that if T2 is the earliest transaction then also the schedule is not conflict serializable.