PART 4 Transaction Processing
PART 4 Transaction Processing
Lecture Series By :
http://www.dhindsa.info
{ Consistency / Inconsistency }
DBMS by Er. K.S.Dhindsa © 2006
ATM NETWORK EXAMPLE
Checking Accounts
Saving Account
Rs. 1000 to 2000
Rs. 5000 to 4000
Transaction
2. Subtract 1000 from savings
3. Add 1000 to checking
DBMS by Er. K.S.Dhindsa © 2006
Processes of Transaction
SERIAL SCHEDULE T1 T2
A=A+100
T1 T2
B=B-100
A=A*7.06
A=A*7.06
B=B*7.06
B=B*7.06
A=A+100
B=B-100
DBMS by Er. K.S.Dhindsa © 2006
Scheduling of Transactions
EQUIVALENT SCHEDULE
NON-SERIAL SCHEDULE
T1 T2 SERIALIZABLE
A=A+100
SCHEDULE ???
A=A*7.06
B=B-100
B=B*7.06
DBMS by Er. K.S.Dhindsa © 2006
STATES OF TRANSACTION
Partially
Committed Committed
active
failed aborted
STATE DIAGRAM
DBMS by Er. K.S.Dhindsa © 2006
Advantages of Concurrent Transaction
A:=A-50 temp=:=A*0.1
Write(A) A=A-temp
Read(B) Write(A)
B:=B+50 read(B)
Write(B) B:=B+temp
Read(A) Write(B)
temp=:=A*0.1 Read(A)
A=A-temp
A:=A-50
Write(A)
Write(A)
read(B)
B:=B+50
B:=B+temp
Write(B) Write(B)
Schedule 1 Schedule 2
TESTING FOR SERIALIZABILITY
T1 T2
T2 T1
Conclusion :
Lecture Series By :
http://www.dhindsa.info