Consider the following transactions operating on database items X and Y with…
2024
Consider the following transactions operating on database items X and Y with initial values:
X = 200, Y = 100
Transaction T₁
Read X
X := X − 10
Write X
Transaction T₂
Read Y
Y := Y + 20
Write Y
Both transactions execute completely and exactly once in any serial order without rollback or failure. What will be the final values of X and Y?
- A.
X = 190, Y = 120
- B.
X = 210, Y = 120
- C.
X = 190, Y = 100
- D.
X = 200, Y = 100
- E.
X = 210, Y = 80
Attempted by 19 students.
Show answer & explanation
Correct answer: A
Step 1 — Note the initial values: X = 200, Y = 100.
Step 2 — Identify which item each transaction modifies:
• T₁ reads X, computes X := X − 10, and writes X. It touches only X.
• T₂ reads Y, computes Y := Y + 20, and writes Y. It touches only Y.
Step 3 — Apply each operation:
• T₁: X = 200 − 10 = 190.
• T₂: Y = 100 + 20 = 120.
Step 4 — Check the effect of the serial order. T₁ works only on X and T₂ works only on Y, so the two transactions operate on disjoint data items. There is no read–write or write–write overlap between them, hence no interference. Whether the serial order is T₁ → T₂ or T₂ → T₁, the outcome is identical.
Since both transactions execute exactly once and commit without rollback, the final values are X = 190 and Y = 120.
Answer: X = 190, Y = 120.