Download presentation
Presentation is loading. Please wait.
Published byIsabel Shaw Modified over 9 years ago
1
Fan Qi fan.qi@nus.edu.sg Database Lab 1, com1 #01-08 CS3223 Tutorial 9
2
Transaction Management ACID Atomicity : Commit or Abort Consistency: DB initial-end state is consistent Isolation: one Xact is unaware of other Xacts Durability: Once commit, forever commit Anomalies Dirty read problem (due to WR conflicts) Unrepeatable read problem (due to RW conflicts) Lost update problem (due to WW conflicts)
3
Transaction Management
4
Not VS, but FSS (T1,T2) Not CSS, but VS (T2, T1)
5
Question 1 A) show serial execution is consistent: T1->T2, A= 0, B = 1 T2->T1, A = 1, B = 0 Read (A) Read (B) If A=0 Update(B) If A=0 Update(B) Write(B) Read (B) Read (A) If B =0 Update(A) If B =0 Update(A) Write(A)
6
Question 1 B) Non serializable: Consider this execution A = 1, B = 1, inconsistent C) Can T1 and T2 be concurrent? No ! Read (A) Read (B) If A=0 Update(B) If A=0 Update(B) Write(B) Read (B) Read (A) If B =0 Update(A) If B =0 Update(A) Write(A) Read (A) Read (B) If A=0 Update(B) If A=0 Update(B) Write(B) Read (B) Read (A) If B =0 Update(A) If B =0 Update(A) Write(A)
7
Question 2 a) R1(X), R2(X), W1(X), W2(X), Commit1, Commit2 b) W1(X), R2(Y), R1(Y), R2(X), Commit1, Commit2 c) R1(X), R2(Y), W3(X), R2(X), R1(Y), Commit1, Commit2, Commit3 d) R1(X), R1(Y), W1(X), R2(Y), W3(Y), W1(X), R2(Y), Commit1, Commit2, Commit3 e) R1(X), W2(X), W1(X), Commit2, Commit1 f) W1(X), R2(X), W1(X), Commit2, Commit1 g) R2(X), W3(X), Commit3, W1(Y), Commit1, R2(Y), W2(Z), Commit2 h) R1(X), W2(X), Commit2, W1(X), Commit1, R3(X), Commit3 i) R1(X), W2(X), W1(X), R3(X), Commit1, Commit2, Commit3
8
Question 3 Final State Serializable ? Yes View Serializable Schedule ? No Conflict Serializable Schedule? No Read (x) Read (y) Write(x) Read(y)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.