← RGPV CS-502 DBMS November 2023 solved question paper
RGPV CS-502 (GS) | November 2023 | Q6(a) | 7 marks
Question (restated): Give a concurrent transaction that interferes with T1 reading and writing X and Y without concurrency control.
Answer
A transaction is a logical unit of database work. Concurrent execution improves throughput but may produce incorrect results if conflicting operations are interleaved without isolation. Consider T1 adding 10 to both X and Y, and T2 adding 20 to X. Assume initial X=100 and Y=200.
| Step | T1 | T2 |
|---|---|---|
| 1 | Read X=100 | |
| 2 | Read X=100 | |
| 3 | Write X=120 | |
| 4 | Write X=110 | |
| 5 | Read Y=200 | |
| 6 | Write Y=210 | |
| 7 | Commit | Commit |
The final X is 110, whereas either serial order would produce X=130. T1 overwrites the update of T2 using a stale value, so this is a lost update. The final Y is 210. The schedule contains conflicting read-write and write-write operations on X.
A second form of interference occurs when T2 reads X after T1 has written it but reads Y before T1 updates it. If X and Y represent related balances, T2 may observe an inconsistent state. If T1 aborts after T2 reads its uncommitted value, a dirty read and cascading rollback may occur.
Concurrency control prevents such effects through locking, timestamp ordering or suitable multiversion isolation. Under strict two-phase locking, T1 acquires an exclusive lock on X before updating it and holds it until commit. T2 must wait before accessing X incompatibly. It then reads the committed value 110 and writes 130. The resulting schedule is equivalent to serial execution for the conflicting operations.
Further reading: Silberschatz, Korth and Sudarshan, Database System Concepts; Elmasri and Navathe, Fundamentals of Database Systems.
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion