Consider table bank_accounts = (account_id, balance), with two accounts A and…
ISRO Scientist/Engineer SC · 2025 · Computer Science · Part A · DisciplineModified — slightly modified from the official paper; see the solution
Consider table bank_accounts = (account_id, balance), with two accounts A and B initially holding Rs. 5,000 each. Two transactions execute concurrently under REPEATABLE READ isolation with standard locking. T1 transfers Rs. 1,000 from A to B and executes BEGIN; READ(A); READ(B); WRITE(A); WRITE(B); END. T2 transfers Rs. 1,000 from B to A and executes BEGIN; READ(B); READ(A); WRITE(B); WRITE(A); END. Each transaction reads both balances, deducts Rs. 1,000 from its source account, adds Rs. 1,000 to the other account, and writes the results. Assume all interleavings are possible and no external factor changes the balances. Which outcome can never occur?
- A.
A’s account balance is Rs. 4,000 and B’s account balance is Rs. 4,000
- B.
Deadlock is detected and T1 is rolled back to recover
- C.
Deadlock is detected and T2 is rolled back to recover
- D.
A’s account balance is Rs. 4,000 and B’s account balance is Rs. 6,000
Attempted by 255 students.
Show answer
Correct answer: A
Explore the full course: Iocl Engineers Officers Grade A Paper 2