Question
Consider the following transactions with data items and initialized to zero:
:
read ();
read ();
if then ;
write ().
:
read ();
read ();
if then ;
write ().
Any non-serial interleaving of and for concurrent execution leads to
Official answer and solution
- Official answer
- B
- From
- Official GATE 2012 answer key
Solution
Trace conflicting read/write operations on data items P and Q across all possible non-serial interleavings of transactions T1 and T2.
- Operations in each transaction:
- : reads , reads , writes (if ).
- : reads , reads , writes (if ).
- Conflicting pairs between and :
- Conflict on item : and are in conflict.
- Conflict on item : and are in conflict.
- In any non-serial interleaving of and :
- Because begins by reading before writes , the conflict introduces a directed edge in the serialization (precedence) graph.
- Concurrently, because reads before writes , the conflict introduces a reverse directed edge in the precedence graph.
-
Thus, both directed edges and are present, forming a directed cycle in the precedence graph.
-
A schedule is conflict serializable if and only if its precedence graph contains no directed cycles. Since a cycle is unavoidably created in every non-serial interleaving, any non-serial execution leads to a schedule that is not conflict serializable.
B
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2012 Computer Science and Information Technology (CS)
- Question
- 27 of 65, printed as CS Q.27
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.