Download presentation
Presentation is loading. Please wait.
1
Durable starting state Durable, consistent, ending state Collection of resource actions Rollback Successful completion Abort The Transaction
2
Transaction Examples Withdraw $100 –Read current balance new balance = current - 100 –Write new balance –Dispense cash Transfer $100 –Read savings (sub 100) –Read checking (add 100) –Write savings –Write checking
3
Resource managers Application logic Transaction manager Join Prepare, commit, abort Transaction architecture
4
Transaction manager Phase 1 prepare() yes_or_no Transaction manager commit() Transaction manager Phase 2 abort() One or more “no’s” All “yes” Rollback Commit or abort
5
Transaction Interference Withdraw $100 –Read checking balance new balance = current - 100 –Write new balance –Dispense cash Transfer $100 –Read savings (sub 100) –Read checking (add 100) –Write savings –Write checking time
6
Transaction_1 Transaction_2 Shared resources Transaction_1Transaction_2 Transaction_1Transaction_2 Two concurrent transactions Give the same result as: Or: Isolation of transactions (Serializability)
7
Bad (Not Serializable) Withdraw $100 –Read checking balance new balance = current - 100 –Write new balance –Dispense cash Transfer $100 –Read savings (sub 100) –Read checking (add 100) –Write savings –Write checking time
8
OK (Same as Withdraw first) Withdraw $100 –Read checking balance new balance = current - 100 –Write new balance –Dispense cash Transfer $100 –Read savings (sub 100) –Read checking (add 100) Write savings –Write checking time
9
Danger from Waiting: Deadlock Transaction 1: –Lock A –Lock B –… –Release all Transaction 2: –Lock B –Lock A –… –Release all
10
Application serverResource managerTransaction manager request(tp_ID,….) join(tp_ID) More requests…. Prepare (tp_ID) commit_or_abort(tp_ID) Lock Commit or rollback Summary OK or Already_locked Unlock
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.