Question:
Which of the following is a conflict serializable schedule?
\(S_1: R_1(A); R_1(B); R_2(A); R_2(B); W_2(B); W_1(A)\)
\(S_2: R_1(A); R_2(A); R_2(B); W_2(B); R_1(B); W_1(A)\)
निम्नलिखित में से कौन सा शेड्यूल कॉन्फ्लिक्ट सीरियलाइज़ेबल (conflict serializable) है?
\(S_1: R_1(A); R_1(B); R_2(A); R_2(B); W_2(B); W_1(A)\)
\(S_2: R_1(A); R_2(A); R_2(B); W_2(B); R_1(B); W_1(A)\)
Options:
- S1 is conflict serializable but S2 is not.
- S1 is not conflict serializable but S2 is conflict serializable.
- Both are not conflict serializable.
- Both are conflict serializable.
- S1 कॉन्फ्लिक्ट सीरियलाइज़ेबल है लेकिन S2 नहीं है।
- S1 कॉन्फ्लिक्ट सीरियलाइज़ेबल नहीं है लेकिन S2 कॉन्फ्लिक्ट सीरियलाइज़ेबल है।
- दोनों कॉन्फ्लिक्ट सीरियलाइज़ेबल नहीं हैं।
- दोनों कॉन्फ्लिक्ट सीरियलाइज़ेबल हैं।
Correct Answer: b)
Explanation:
To test conflict serializability, we inspect the precedence graph for cycles:
– **For schedule \(S_1\)**:
– Item \(B\): \(R_1(B)\) comes before \(W_2(B)\), creating directed edge \(T_1 \to T_2\).
– Item \(A\): \(R_2(A)\) comes before \(W_1(A)\), creating directed edge \(T_2 \to T_1\).
– Because there is a cycle (\(T_1 \leftrightarrow T_2\)), \(S_1\) is **NOT conflict serializable**.
– **For schedule \(S_2\)**:
– Item \(A\): \(R_2(A)\) comes before \(W_1(A)\), creating edge \(T_2 \to T_1\).
– Item \(B\): \(W_2(B)\) comes before \(R_1(B)\), creating edge \(T_2 \to T_1\).
– The graph has no cycle (only \(T_2 \to T_1\)), so \(S_2\) is **conflict serializable** (equivalent to serial schedule \(T_2 \to T_1\)).
कॉन्फ्लिक्ट सीरियलाइज़ेबिलिटी का परीक्षण प्रेसिडेंस ग्राफ़ बनाकर किया जाता है:
– **\(S_1\) के लिए**:
– डेटा आइटम \(B\) पर \(R_1(B)\) पहले है \(W_2(B)\) से \(\implies T_1 \to T_2\).
– डेटा आइटम \(A\) पर \(R_2(A)\) पहले है \(W_1(A)\) से \(\implies T_2 \to T_1\).
– यह चक्र (cycle) बनाता है, अतः \(S_1\) कॉन्फ्लिक्ट सीरियलाइज़ेबल नहीं है।
– **\(S_2\) के लिए**:
– डेटा आइटम \(A\) पर \(R_2(A)\) पहले है \(W_1(A)\) से \(\implies T_2 \to T_1\).
– डेटा आइटम \(B\) पर \(W_2(B)\) पहले है \(R_1(B)\) से \(\implies T_2 \to T_1\).
– इसमें कोई चक्र नहीं है, अतः \(S_2\) कॉन्फ्लिक्ट सीरियलाइज़ेबल है (सीरियल क्रम \(T_2 \to T_1\) के समकक्ष)।