62.5 KB · commit 40bb182
| title | T10 · Serializability · Explanations |
|---|
← Prev: T09 · Transactions, ACID and Anomalies | Exam-style layer | Next: T11 · Concurrency Control Protocols →
| ID | Subtopic | Marks (Finals + CT) | Questions | Jump |
|---|---|---|---|---|
| T10.1 | Define conflicting instructions & conflict serializability | 2 + 0 | 2017 Q.5(b) | Go |
| T10.2 | Conflict equivalence by swapping (proof) | 4 + 0 | 2020 Q.5(c) | Go |
| T10.3 | Precedence-graph test → cycle → serial order(s) | 26 + 6 | 2018 Q.6(c), 2020 Q.6(a), 2021 Q.7(b), 2021 Q.7(c), 2023 Q.8(b), 2024 Q.8(c), CT-04 Q.04 | Go |
| T10.4 | Build serializable/non-serializable schedules (T1,T2 with "if A = 0 then B := B+1") | 13 + 0 | 2017 Q.5(c), 2019 Q.4(a) | [[#T10.4 · Build serializable/non-serializable schedules (T1,T2 with "if A = 0 then B := B+1")|Go]] |
| T10.5 | View serializability (3 conditions, blind writes) | 6 + 0 | 2020 Q.6(b) | Go |
| T10.6 | Recoverable / cascadeless / strict schedules | 0 + 0 | No questions | Go |
Section B · Asked in: 2017 · L1 (asked once)
Question. What do you know about conflict serializability?
Answer.
What the examiner wants. A crisp definition of conflict serializability (1 mark) and the rule identifying conflicting operations or graph testing (1 mark).
Key idea. A serial schedule executes transactions one after another with no overlap. It is inherently safe. A concurrent schedule interleaves operations from different transactions. If we can rearrange that concurrent schedule into a serial schedule by only swapping adjacent instructions that do not interfere with each other, the concurrent schedule is just as safe as the serial schedule. We call such a schedule conflict serializable.
Step-by-step solution.
Check.
Exam tip. For a 2-mark question, write the definition of conflict serializability and list the 4 read/write cases in 3 to 4 lines.
Sources.
Section B · Asked in: 2020 · L1 (asked once)
Question. Draw a concurrent schedule equivalent to serial schedule. Prove its step by step swapping process.
Answer.
What the examiner wants. A drawn concurrent schedule table (1.5 marks), a clear statement of the swapping rule (0.5 marks), and the numbered step-by-step swap sequence that yields a serial schedule (2 marks).
Key idea. In an interleaved schedule, operations on different data items do not interfere. If transaction T2 operates on item A while transaction T1 operates on item B, they do not conflict. We can safely push T1's operations to the left (earlier) and T2's operations to the right (later) by swapping adjacent pairs until all T1 operations precede all T2 operations.
Step-by-step solution.
Let T1 and T2 be two transactions operating on items A and B:
We draw the concurrent schedule S, where T2's operations on A are interleaved before T1's operations on B:
| Step | T1 | T2 |
|---|---|---|
| 1 | read(A) | |
| 2 | write(A) | |
| 3 | read(A) | |
| 4 | write(A) | |
| 5 | read(B) | |
| 6 | write(B) | |
| 7 | read(B) | |
| 8 | write(B) |
Two adjacent instructions Ii and Ij can be swapped if and only if they do not conflict. Since Ii accesses item A and Ij accesses item B, they access distinct data items (A=B). Therefore, they never conflict and can be swapped without changing the result of the schedule.
We move T1's instructions on B ahead of T2's instructions on A:
Initial Instruction List:
Swap 1: Swap adjacent instructions at positions 4 and 5 (T2:write(A) and T1:read(B)).
Swap 2: Swap adjacent instructions at positions 3 and 4 (T2:read(A) and T1:read(B)).
Swap 3: Swap adjacent instructions at positions 5 and 6 (T2:write(A) and T1:write(B)).
Swap 4: Swap adjacent instructions at positions 4 and 5 (T2:read(A) and T1:write(B)).
The instructions now form a serial schedule S′ where T1 executes completely, followed by T2:
| Step | T1 | T2 |
|---|---|---|
| 1 | read(A) | |
| 2 | write(A) | |
| 3 | read(B) | |
| 4 | write(B) | |
| 5 | read(A) | |
| 6 | write(A) | |
| 7 | read(B) | |
| 8 | write(B) |
This is the serial schedule ⟨T1,T2⟩.
Result: Since schedule S was transformed into serial schedule ⟨T1,T2⟩ through 4 valid swaps of non-conflicting adjacent instructions, S is conflict equivalent to ⟨T1,T2⟩ and is conflict serializable.
Check.
Exam tip. Always draw the initial interleaved schedule in table form first. Then number each swap explicitly and state: "Different items, so non-conflicting."
Sources.
Section B · Asked in: 2018 · L3 (repeated schedule in 2024)
Question. Consider the following schedule.
| T1 | T2 |
|---|---|
| read(A); | |
| A:=A+10; | |
| read(A); | |
| A:=A-100; | |
| write(A); | |
| read(B); | |
| write(A); | |
| read(B); | |
| B:=B-10; | |
| write(B) | |
| B:=B+100; | |
| write(B); |
Answer.
What the examiner wants. Chronological extraction of conflicting read/write instructions (1 mark), edge listing for the precedence graph (1.5 marks), graph diagram and cycle detection (1 mark), and the final verdict (0.5 marks).
Key idea. A schedule of transactions is conflict serializable if and only if its precedence graph is acyclic. We build the graph by checking pairs of conflicting instructions on the same data item. If T1 accesses an item before T2 performs a conflicting operation, we draw an edge T1→T2. If another pair requires T2→T1, a cycle forms, proving the schedule cannot be serialized.
Step-by-step solution.
We ignore local arithmetic (A:=A+10, etc.) and focus on the database read and write instructions in order:
We compare instructions between different transactions on the same data item where at least one is a write:

The precedence graph consists of vertices {T1,T2} and directed edges:
This produces a directed cycle:
T1⟷T2Result: The precedence graph contains a cycle. Therefore, the schedule is NOT conflict serializable.
Check.
Exam tip. Always check both data items (A and B). Even if you spot the cycle on item A, listing the conflicts on item B guarantees full marks.
Sources.
Section B · Asked in: 2020 · L1 (asked once)
Question. Which of the following schedule is (conflict) serializable? For each serializable schedule, determine the equivalent serial schedules.
(i) r1(X);r3(X);w1(X);r2(X);w3(X)
(ii) r1(X);r3(X);w3(X);w1(X);r2(X)
Answer.
What the examiner wants. Independent analysis of schedule (i) (3 marks) and schedule (ii) (3 marks). For each schedule, list all conflicting pairs, construct the precedence graph, test for cycles, and give equivalent serial schedules if serializable.
Key idea. Both schedules operate on a single item X across three transactions T1,T2,T3. Any two operations from different transactions conflict if at least one is a write. We check each pair chronologically to build the precedence graph for each schedule.
Step-by-step solution.
Step-by-step conflict analysis on item X:
Summary of directed edges:
T1⟶T3,T3⟶T1,T1⟶T2,T2⟶T3
Cycle detection:
Verdict for (i): The precedence graph contains cycles. Schedule (i) is NOT conflict serializable. There is no equivalent serial schedule.
Step-by-step conflict analysis on item X:
Summary of directed edges:
T1⟶T3,T3⟶T1,T3⟶T2,T1⟶T2
Cycle detection:
Verdict for (ii): The precedence graph contains a cycle. Schedule (ii) is NOT conflict serializable. There is no equivalent serial schedule.
Conclusion: Neither schedule (i) nor schedule (ii) is conflict serializable.
Check.
Exam tip. Label each edge with the operation pair that creates it (for example, r1(X)→w3(X)). This leaves no room for marks deduction.
Sources.
Section B · CLO3 · Asked in: 2021 · L1 (asked once)
Question. Define conflict serializability. Check whether the following schedule is a conflict serializable or not.
| $T_1$ | $T_2$ |
|---|---|
| read(A) | |
| write(A) | |
| read(A) | |
| write(A) | |
| read(B) | |
| write(B) | |
| read(B) | |
| write(B) |
Answer.
What the examiner wants. Formal definition of conflict serializability (1 mark), conflict pair analysis (1.5 marks), precedence graph and serializability test (1 mark), and the equivalent serial order (0.5 marks).
Key idea. In this schedule, T1 finishes all operations on A before T2 touches A. Then T1 finishes all operations on B before T2 touches B. Because T1 precedes T2 on both items and T2 never executes anything before T1, all directed edges flow strictly from T1 to T2. There can be no cycles.
Step-by-step solution.
A schedule S is conflict serializable if it is conflict equivalent to some serial schedule. Two schedules are conflict equivalent if one can be transformed into the other by a sequence of non-conflicting adjacent instruction swaps.
We examine the 8 operations in order:
Conflicting pairs:
Every single conflict edge goes from T1 to T2. No operation in T2 precedes any conflicting operation in T1.

The graph contains two vertices {T1,T2} and a single directed edge:
T1⟶T2The graph is acyclic.
Result: The schedule is conflict serializable. The unique equivalent serial schedule is:
⟨T1,T2⟩Check.
Exam tip. Always explicitly state the equivalent serial order ⟨T1,T2⟩ whenever you conclude that a schedule is serializable.
Sources.
Section B · CLO3 · Asked in: 2021 · L1 (asked once)
Question. Consider the following schedule:
| $T_1$ | $T_2$ |
|---|---|
| r(A) | |
| w(A) | |
| r(B) | |
| w(B) | |
| r(B) | |
| w(B) | |
| r(A) | |
| w(A) |
Answer.
What the examiner wants. Extraction of conflicts for A and B (1.5 marks), drawing the precedence graph (1.5 marks), cycle detection and answering the serial order question (1 mark).
Key idea. T1 acts first on item A, while T2 acts first on item B. This symmetry creates a forward edge T1→T2 on item A and a backward edge T2→T1 on item B. This results in a cycle.
Step-by-step solution.
All conflicting operations on item A require:
T1⟶T2All conflicting operations on item B require:
T2⟶T1
The precedence graph consists of:
This forms a directed cycle:
T1⟷T2Result: Because the precedence graph contains a cycle, the schedule is NOT serializable. Since it is not serializable, no order of execution exists.
Check.
Exam tip. Draw the graph clearly with circles for T1 and T2. Label the top arrow A and the bottom arrow B to clearly highlight the cycle.
Sources.
Section B · CLO3 · Asked in: 2023 · L1 (asked once)
Question. Check whether the given schedules S is conflict serializeable or not. If yes, then determine all the possible serialized schedules.
| $T_1$ | $T_2$ | $T_3$ | $T_4$ |
|---|---|---|---|
| $R(A)$ | |||
| $R(A)$ | |||
| $W(B)$ | |||
| $R(A)$ | |||
| $W(A)$ | |||
| $R(B)$ | |||
| $W(B)$ |
Answer.
What the examiner wants. Complete list of conflicting pairs (1 mark), drawing the 4-node precedence graph (1 mark), acyclic verdict (0.5 marks), and finding all valid topological sorts (1.5 marks).
Key idea. With 4 transactions, the precedence graph defines a partial order. If the graph has no cycles, it is conflict serializable. Because some transactions have no direct or indirect dependency between them, there may be more than one valid topological sort. The question asks for all possible serialized schedules, so we must find every single one.
Step-by-step solution.
Let the rows of schedule S be indexed 1 to 7:

The directed edges are:
There are no backward edges, so the precedence graph is acyclic.
Verdict: Schedule S is conflict serializable.
We perform topological sorting on the directed acyclic graph:
Therefore, T4 can be placed in any position as long as it appears before T2:
Result: There are exactly 3 possible serialized schedules.
Check.
Exam tip. When asked for "all possible serialized schedules", state the partial ordering constraints first. Then show each position where the unconstrained transaction can fit.
Sources.
Section B · CO3 · Asked in: 2024 · L3 (same schedule as 2018 Q.6(c))
Question. Consider the following schedule:
| $T_1$ | $T_2$ |
|---|---|
| read (A); A=A+10; | |
| read (A); A=A-100; write (A); read (B); | |
| write (A); read (B); B=B-10; write (B); | |
| B=B+100; write (B); |
Answer.
What the examiner wants. Extraction of read/write operations (1 mark), finding conflicts for items A and B (1.5 marks), precedence graph and cycle detection (1 mark), and concluding verdict (0.5 marks).
Key idea. The question presents blocks of operations per column. We convert them into a chronological timeline of database reads and writes. A conflict exists whenever two transactions touch the same item and at least one writes. If opposite conflicting directions exist, a cycle forms.
Step-by-step solution.
Because we have both T1→T2 and T2→T1, there is an immediate cycle on item A.
Item B also creates conflicting dependencies in both directions: T2→T1 and T1→T2.

The precedence graph consists of vertices {T1,T2} and directed edges T1→T2 and T2→T1. This creates a cycle:
T1⟷T2Result: Because the precedence graph contains a cycle, the schedule is NOT conflict serializable.
Check.
Exam tip. RUET repeated this exact question from 2018. Writing the steps clearly with step numbers gives maximum marks.
Sources.
Asked in: CT-04 · CO3 · L1 (asked once)
Question. Determine whether the schedule is conflict serializable or not. If it is serializable, give the equivalent serial order.
| T1 | T2 | T3 |
|---|---|---|
| Write(A) | ||
| Read(A) | ||
| Write(B) | ||
| Write(B) | ||
| Write(B) | ||
| Write(A) | ||
| Read(B) | ||
| Read(B) |
Answer.
What the examiner wants. Chronological indexing of the 8 steps (1 mark), identification of conflicting pairs for items A and B (2 marks), precedence graph construction (1.5 marks), cycle detection and verdict (1.5 marks).
Key idea. With multiple writes on item B interleaving across T1 and T3, we must trace the operations step by step. If T3 writes B before T1 writes B, we get T3→T1. If T1 writes B before T3 writes or reads B again, we get T1→T3. That produces a cycle.
Step-by-step solution.
Conflicts on data item A:
Conflicts on data item B:

The graph contains:
Between T1 and T3, there is a direct cycle:
T1⟷T3Result: The precedence graph contains a cycle. The schedule is NOT conflict serializable. Because it is non-serializable, no equivalent serial order exists.
Check.
Exam tip. In class tests, showing the step numbers for conflicting instructions proves you did not guess the cycle.
Sources.
Section B · Asked in: 2017 · L1 (asked once)
Question. Consider the following two transactions.
T1:
read(A);
read(B);
if A = 0 then B:=B+1;
write(B);
T2:
read(B);
read(A);
if B = 0 then A:=A+1;
write(A);
Let the consistency requirement be A=0 or B=0 with A=B=0 the initial values.
(i) Show a concurrent execution of T1 and T2 that produces a nonserializable schedule.
(ii) Is there a concurrent execution of T1 and T2 that produces a serializable schedule?
Answer.
What the examiner wants. Baseline analysis of serial executions (1 mark), constructing an interleaved schedule and proving inconsistency and non-serializability (3 marks), and rigorous proof that no concurrent execution can be serializable (2 marks).
Key idea. T1 increments B only if A=0. T2 increments A only if B=0. If they run serially, whichever runs first changes its target variable from 0 to 1. The second transaction then sees a non-zero value and does not change its variable. One variable becomes 1 while the other remains 0, preserving consistency (A=0∨B=0). But if they interleave so that both read before either writes, both see 0. Both increment their variables, resulting in A=1,B=1. That violates consistency and forms a cycle.
Step-by-step solution.
Initial state: A=0,B=0. Consistency requirement: A=0∨B=0.
B = 0 is false (1=0). It does not increment A. It writes A=0.A = 0 is false (1=0). It does not increment B. It writes B=0.We construct a schedule where both transactions read both items before either performs its write:
| Step | Transaction | Instruction | Value Read / Action |
|---|---|---|---|
| 1 | T1 | read(A); | Reads initial value A=0 |
| 2 | T2 | read(B); | Reads initial value B=0 |
| 3 | T1 | read(B); | Reads initial value B=0 |
| 4 | T2 | read(A); | Reads initial value A=0 |
| 5 | T1 | if A = 0 then B:=B+1;write(B); | A=0 is true ⟹B:=0+1=1. Writes B=1. |
| 6 | T2 | if B = 0 then A:=A+1;write(A); | B=0 is true ⟹A:=0+1=1. Writes A=1. |
Final Database State:
A=1andB=1This violates the consistency requirement A=0∨B=0 because neither A nor B is 0.

Proof of Non-serializability:
Answer: No.
Proof: In a genuinely concurrent (interleaved) execution, the instructions of T1 and T2 must overlap in time:
write(A) is T2's final operation). But if T2 finishes before T1 starts reading A, T2 executed serially before T1.write(B) is T1's final operation). But if T1 finishes before T2 starts reading B, T1 executed serially before T2.For any schedule that is truly interleaved (concurrent), T1 must read A before T2 writes A, and T2 must read B before T1 writes B. This forces both directed edges:
T1⟶T2andT2⟶T1This creates a cycle T1⟷T2 in every concurrent execution. Therefore, every concurrent execution is non-serializable. Only strictly serial executions (⟨T1,T2⟩ and ⟨T2,T1⟩) are serializable.
Check.
Exam tip. This is Silberschatz Exercise 17.15. Remembering the final result (A=1,B=1) and the cycle T1↔T2 allows you to write the answer quickly.
Sources.
Section A · Asked in: 2019 · L1 (asked once)
Question. What is concurrency control? Consider the following two transactions.
T1:
read (P);
read (Q);
if P=10 then Q:=Q-5;
write (Q);
T2:
read (Q);
read (P);
if Q=10 then P:=P+5;
write (P);
Let the consistency requirement be P=5 or Q=5 with P=Q=5 the initial values.
(i) Show a concurrent execution of T1 and T2 that produces a serializable schedule.
(ii) Is there a concurrent execution of T1 and T2 that produces a serializable schedule?
(Note: In the printed question paper, sub-question (ii) is printed identically to (i) as "Is there a concurrent execution of T1 and T2 that produces a serializable schedule?")
Answer.
What the examiner wants. Definition of concurrency control (2 marks), handling of the printed transaction scenario with initial values and IF conditions (2.5 marks), and analysis of serializable vs non-serializable concurrent schedules (2.5 marks).
Key idea. Concurrency control ensures database consistency when multiple transactions run simultaneously. The given scenario is adapted from Silberschatz Exercise 17.15, but has typographical errors in the question paper. We address the question as printed, and also explain the textbook intent.
Step-by-step solution.
Concurrency control is the DBMS subsystem that manages simultaneous execution of transactions on a shared database. Its main goals are:
Assumption: In the printed 2019 paper, sub-question (i) misprinted "non-serializable" as "serializable" (making (i) and (ii) ask the same thing), and the IF conditions test P = 10 / Q = 10 while initial values are P = Q = 5. We address both the intended Silberschatz Exercise 17.15 reading and the literal printed text.
if P=10 and if Q=10): In T1, P is read as 5, so P = 10 evaluates to false and T1 writes Q=5. In T2, Q is read as 5, so Q = 10 evaluates to false and T2 writes P=5.if P=5 and if Q=5):
Because Part (i) in Silberschatz Exercise 17.15 (and 2017 Q.5c) asks to show a concurrent execution that produces a non-serializable schedule, we provide both the intended non-serializable interleaved schedule and the serial baseline schedule.
Consider an interleaved execution where both transactions finish reading before either writes:
| Step | T1 | T2 | Action (Intended if P=5 / if Q=5) | Action (As-Printed if P=10 / if Q=10) |
|---|---|---|---|---|
| 1 | read(P); | T1 reads P=5 | T1 reads P=5 | |
| 2 | read(Q); | T2 reads Q=5 | T2 reads Q=5 | |
| 3 | read(Q); | T1 reads Q=5 | T1 reads Q=5 | |
| 4 | read(P); | T2 reads P=5 | T2 reads P=5 | |
| 5 | write(Q); | Sees P=5 (true) ⟹ writes Q=0 | Sees P=10 (false) ⟹ writes Q=5 | |
| 6 | write(P); | Sees Q=5 (true) ⟹ writes P=10 | Sees Q=10 (false) ⟹ writes P=5 |

Conflicts:
The precedence graph contains a directed cycle:
T1⟷T2Because of this cycle, this interleaved schedule is NOT conflict serializable. Under the intended guards (if P=5 and if Q=5), it produces P=10 and Q=0, violating the consistency requirement P=5∨Q=5.
As proven in Part (ii) below, no genuinely interleaved (concurrent) schedule of T1 and T2 can be conflict-serializable. Only a non-interleaved serial execution where T1 completes all its operations before T2 begins (or vice versa) yields an acyclic precedence graph (T1→T2, serial order ⟨T1,T2⟩):
| Step | T1 | T2 | Local Actions (As Printed) |
|---|---|---|---|
| 1 | read(P); | T1 reads P=5 | |
| 2 | read(Q); | T1 reads Q=5 | |
| 3 | if P=10 then Q:=Q-5;write(Q); | Condition false; writes Q=5 | |
| 4 | read(Q); | T2 reads Q=5 | |
| 5 | read(P); | T2 reads P=5 | |
| 6 | if Q=10 then P:=P+5;write(P); | Condition false; writes P=5 |
Answer: No (not for conflict serializability).
Proof: In a genuinely concurrent (interleaved) execution, the instructions of T1 and T2 must overlap in time:
read(P) and T2's final instruction is write(P). If T2 wrote P before T1 read P, then T2 would have finished its entire execution before T1 even started, which is the serial schedule ⟨T2,T1⟩. Thus, in any genuinely interleaved schedule, T1:read(P) must precede T2:write(P), forcing the edge T1→T2.read(Q) and T1's final instruction is write(Q). If T1 wrote Q before T2 read Q, then T1 would have finished its entire execution before T2 even started, which is the serial schedule ⟨T1,T2⟩. Thus, in any genuinely interleaved schedule, T2:read(Q) must precede T1:write(Q), forcing the edge T2→T1.Therefore, any genuinely interleaved execution forces both edges:
T1⟶T2andT2⟶T1This creates a cycle T1⟷T2 in every concurrent execution. Hence, no concurrent execution of T1 and T2 can produce a conflict-serializable schedule. Only strictly serial executions (⟨T1,T2⟩ and ⟨T2,T1⟩) are conflict-serializable.
Check.
Exam tip. Always answer both what is printed and what was clearly intended. This ensures you receive full credit regardless of which marking scheme the examiner follows.
Sources.
Section B · Asked in: 2020 · L1 (asked once)
Question. What is view serializability? Why do we need view serializability? Check the view serializability of the following schedule if any.
| T1 | T2 |
|---|---|
| R(X) | |
| W(X) | |
| R(X) | |
| W(X) | |
| R(Y) | |
| W(Y) | |
| R(Y) | |
| W(Y) |
Answer.
What the examiner wants. Formal definition of view serializability with all three conditions (2 marks), explanation of why it is needed and the role of blind writes (2 marks), and testing the given schedule against the serial schedule (2 marks).
Key idea. Conflict serializability is based on swapping non-conflicting adjacent instructions. Sometimes a schedule produces the exact same read flows and final state as a serial schedule, but cannot be swapped because of "blind writes" (writes with no preceding read). View serializability is a broader definition that focuses on who reads whose writes and who writes last.
Step-by-step solution.
A schedule S is view serializable if it is view equivalent to some serial schedule S′.
Two schedules S and S′ with the same set of transactions are view equivalent if the following three conditions hold for every data item Q:
We represent the given schedule S in table form:
| Step | T1 | T2 | Data Item |
|---|---|---|---|
| 1 | R(X) | X | |
| 2 | W(X) | X | |
| 3 | R(X) | X | |
| 4 | W(X) | X | |
| 5 | R(Y) | Y | |
| 6 | W(Y) | Y | |
| 7 | R(Y) | Y | |
| 8 | W(Y) | Y |
We test whether S is view equivalent to the serial schedule S′=⟨T1,T2⟩:

All three conditions are fully satisfied with respect to the serial schedule ⟨T1,T2⟩. (Also, the precedence graph has only edges T1→T2, meaning S is also conflict serializable).
Result: The schedule is view serializable, equivalent to the serial schedule:
⟨T1,T2⟩Check.
Exam tip. Whenever a schedule has no blind writes and is conflict serializable, it is automatically view serializable. Mentioning this connection demonstrates strong conceptual understanding.
Sources.
No questions from past finals or class tests.
← Prev: T09 · Transactions, ACID and Anomalies | Exam-style layer | Next: T11 · Concurrency Control Protocols →