Let and denote read and write operations on a data element by a transaction respectively. Consider the schedule with four transactions.
Which one of the following serial schedules is conflict equivalent to
View worked solution
Answer: A
To find the serial schedule that is conflict equivalent to the given schedule , we construct its precedence graph. In a precedence graph, a directed edge exists if there is a conflict between an operation in and a subsequent operation in .
Two operations conflict if they belong to different transactions, access the same data item, and at least one of them is a write operation.
1. Identify Conflicting Operations
For data item :
- occurs before
- occurs before
For data item :
- occurs before
- occurs before
- occurs before
- occurs before
2. Construct the Precedence Graph
Combining all the directed edges, we get:
3. Topological Sort
We find the topological order of the vertices in this Directed Acyclic Graph (DAG):
- has an in-degree of . We select first.
- After removing , the in-degree of becomes . We select next.
- After removing , the in-degree of becomes . We select next.
- Finally, only remains, which has an in-degree of now. We select .
Thus, the unique topological sort is:
This corresponds to the serial schedule .
Free practice · Your answers on this page are not saved.
