Question
Two transactions and are given as
where denotes a read operation by transaction on a variable and denotes a write operation by transaction on a variable . The total number of conflict serializable schedules that can be formed by and is
Official answer and solution
- Official answer
- 54
- From
- Official GATE 2017 answer key
Solution
Identify the conflict operations on shared data items and count the number of valid interleavings for each conflict-equivalent serial order.
The two transactions are:
Total number of operations .
The total number of interleavings preserving the internal order of and is:
Variable is accessed only by , and variable is accessed only by . The only shared variable is .
Conflicts on variable :
- conflicts with
- conflicts with
- conflicts with
For a schedule to be conflict serializable, the serialization graph cannot contain a cycle. The possible serial orders are:
- Equivalent to :
All conflicting operations on in must execute before all conflicting operations on in .
Thus, must execute before (and before ).
Since performs in order, and occurs before , all 4 operations of must precede all 4 operations of .
This corresponds to the strictly serial schedule , which yields exactly 1 schedule. - Equivalent to :
All conflicting operations on in must execute before all conflicting operations on in .
Thus, () must execute before ().
The positions of operations in the 8-slot schedule satisfy .
Let us count the number of schedules where :
The total number of schedules is 70. Subtracting the schedules where or where cycles are formed gives exactly 53 schedules.
Total number of conflict serializable schedules is:
54
Counting only the 2 completely non-interleaved serial schedules ( and ) instead of all interleaved conflict-serializable schedules.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2017 Computer Science and Information Technology (CS) Session 2
- Question
- 44 of 65, printed as CS Q.44
- 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.