Question Details

Consider the database transactions T1 and T2, and data items X and Y. Which of the schedule(s) is/are conflict serializable?


Options

A

R1(X), W2(X), W1(Y), W2(Y), R1(X), W1(X), COMMIT(T2), COMMIT(T1)

B

W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)

C

R1(X), W1(Y), W2(X), W2(Y), R1(X), W1(X), COMMIT(T1), COMMIT(T2)

D

W2(X), R1(X), W1(Y), W2(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)

Show Answer

Correct Answer :

Option B

W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)

Solution :

The correct schedule that is conflict serializable is:
W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)

Image Analysis:
Based on the provided image, we can identify two transactions and their list of sequential operations:
1. Transaction T1: R1(X), W1(Y), R1(X), W1(X), COMMIT(T1)
2. Transaction T2: The first operation is labeled as W1(X) in the image (which is a typo for W2(X) since it belongs to Transaction T2), followed by W2(Y), and then COMMIT(T2).

Concept of Conflict Serializability:
A schedule is conflict serializable if it is conflict equivalent to a serial schedule. We determine this by constructing a precedence graph where the transactions are nodes, and directed edges are added between transactions if they have conflicting operations. Two operations from different transactions conflict if they access the same data item and at least one of them is a write operation (W). If the precedence graph has no cycles, the schedule is conflict serializable.

Let us analyze the conflicting operations in the correct schedule:

S = W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)

1. Conflicts on data item X:
- W2(X) in T2 occurs before R1(X) in T1. This creates a precedence edge:
T2T1
- W2(X) in T2 occurs before W1(X) in T1. This also yields the same edge:
T2T1

2. Conflicts on data item Y:
- W2(Y) in T2 occurs before W1(Y) in T1. This creates a precedence edge:
T2T1

Combining all the conflicts, the precedence graph contains only a single directed edge:
T2T1
Since there are no cycles in the precedence graph, the schedule is conflict serializable (equivalent to the serial order T2 followed by T1).

Why other options are not conflict serializable:
- For R1(X), W2(X), W1(Y), W2(Y), R1(X), W1(X)...: R1(X) occurs before W2(X) (giving T1T2), but W2(X) occurs before W1(X) (giving T2T1), creating a cycle.
- For R1(X), W1(Y), W2(X), W2(Y), R1(X), W1(X)...: Similarly, R1(X) before W2(X) and W2(X) before W1(X) creates a cycle between T1 and T2.
- For W2(X), R1(X), W1(Y), W2(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1): Here, W2(X) before R1(X) gives T2T1 for X, but W1(Y) before W2(Y) gives T1T2 for Y, creating a cycle.

Unlock Our Free Library

Access expert-curated educational resources and study materials—completely free.

Ask AI Tutor
5 left
Q1 View Question & Options
AI Tutor is solving this question...
Reading question context & options...