Answer: B
A schedule is conflict-serializable if its precedence graph contains no cycles. The vertices of the graph are the transactions, and a directed edge Ti→Tj exists if there is a conflicting pair of operations (accessing the same data item with at least one write operation) such that Ti's operation occurs before Tj's operation.
Let's analyze each schedule:
- Schedule S1:
- R2[x] occurs before W1[x]⟹T2→T1
- W1[y] occurs before W2[y]⟹T1→T2
Since there is a cycle (T1↔T2), S1 is not conflict-serializable.
- Schedule S2:
- R2[x] occurs before W1[x]⟹T2→T1
- R2[y] occurs before W1[y]⟹T2→T1
- W2[y] occurs before W1[y]⟹T2→T1
The only directed edge is T2→T1. Since there are no cycles, S2 is conflict-serializable.
- Schedule S3:
- W1[x] occurs before R2[x]⟹T1→T2
- W1[y] occurs before R2[y]⟹T1→T2
- W1[y] occurs before W2[y]⟹T1→T2
The only directed edge is T1→T2. Since there are no cycles, S3 is conflict-serializable.
- Schedule S4:
- R2[x] occurs before W1[x]⟹T2→T1
- W1[y] occurs before W2[y]⟹T1→T2
Since there is a cycle (T1↔T2), S4 is not conflict-serializable.
Thus, only S2 and S3 are conflict-serializable.