Professional Documents
Culture Documents
Atomic Transactions in Distributed Systems: CS-4513 D-Term 2007
Atomic Transactions in Distributed Systems: CS-4513 D-Term 2007
Distributed Systems
CS-4513
D-Term 2007
(Slides include materials from Operating System Concepts, 7th ed., by Silbershatz, Galvin, & Gagne,
Modern Operating Systems, 2nd ed., by Tanenbaum, and Distributed Systems: Principles & Paradigms, 2nd
ed. By Tanenbaum and Van Steen)
Atomic Transactions
Definition Transaction
A sequence of operations that perform a
single logical function
Examples
Atomic Transactions
Example:
Cash machine hands you cash and deducts amount
from your account
Airline confirms your reservation and
Reduces number of free seats
Charges your credit card
(Sometimes) increases number of meals loaded on flight
Atomic Transactions
Atomic Transactions
Failure modes
Crash or other failure of one site or system
Network failure or partition
Byzantine failures
CS-4513, D-Term 2007
Atomic Transactions
Two-Phase Commit
One site is elected coordinator of the
transaction T
See Election algorithms (ppt, html)
Atomic Transactions
Atomic Transactions
Atomic Transactions
coordinator
participant
Atomic Transactions
Atomic Transactions
10
Atomic Transactions
11
Coordinator Crash
Inspect Log
If Abort or Commit state
Resend corresponding message
Take corresponding local action
Atomic Transactions
12
No Response to Participants
Ready_to_commit(T) message
Re-contact coordinator, ask what to do
If unable to contact coordinator, contact other
participants, ask if they know
If any other participant is in Abort or Commit state
Take equivalent action
Atomic Transactions
13
Participant Crash
Inspect local log
Commit state:
Redo/replay the transaction
Abort state:
Undo/abort the transaction
No records about T:
Same as local_abort(T)
Ready State:
Same as no response to Ready_to_commit(T) message
CS-4513, D-Term 2007
Atomic Transactions
14
Atomic Transactions
15
Three-Phase Commit
Minor variation
Widely quoted in literature
Rarely implemented
Because indefinite blocking due to coordinator
failures doesnt happen very often in real life!
Atomic Transactions
16
Atomic Transactions
17
Atomic Transactions
18
Atomic Transactions
19
Contact others
If any in Abort, then abort transaction
If any in Precommit, the move to Precommit state
Atomic Transactions
20
Atomic Transactions
21
Atomic Transactions in
Distributed Systems
CS-4513
D-Term 2007
(Slides include materials from Operating System Concepts, 7th ed., by Silbershatz, Galvin, & Gagne,
Modern Operating Systems, 2nd ed., by Tanenbaum, and Distributed Systems: Principles & Paradigms, 2nd
ed. By Tanenbaum and Van Steen)
Atomic Transactions
Assumptions:
Graduate level
Operating Systems
Making Choices about operation systems
Why a micro-century? just about enough time for one
concept
Definition Transaction
A sequence of operations that perform a
single logical function
Examples
Atomic Transactions
Example:
Cash machine hands you cash and deducts amount
from your account
Airline confirms your reservation and
Reduces number of free seats
Charges your credit card
(Sometimes) increases number of meals loaded on flight
CS-4513, D-Term 2007
Atomic Transactions
Atomic Transactions
Failure modes
Crash or other failure of one site or system
Network failure or partition
Byzantine failures
CS-4513, D-Term 2007
Atomic Transactions
Two-Phase Commit
One site is elected coordinator of the
transaction T
See Election algorithms (ppt, html)
Atomic Transactions
Atomic Transactions
Atomic Transactions
coordinator
participant
Atomic Transactions
Atomic Transactions
10
10
Atomic Transactions
11
11
Coordinator Crash
Inspect Log
If Abort or Commit state
Resend corresponding message
Take corresponding local action
Atomic Transactions
12
12
No Response to Participants
Ready_to_commit(T) message
Re-contact coordinator, ask what to do
If unable to contact coordinator, contact other
participants, ask if they know
If any other participant is in Abort or Commit state
Take equivalent action
Atomic Transactions
13
13
Participant Crash
Inspect local log
Commit state:
Redo/replay the transaction
Abort state:
Undo/abort the transaction
No records about T:
Same as local_abort(T)
Ready State:
Same as no response to Ready_to_commit(T) message
CS-4513, D-Term 2007
Atomic Transactions
14
14
Atomic Transactions
15
15
Three-Phase Commit
Minor variation
Widely quoted in literature
Rarely implemented
Because indefinite blocking due to coordinator
failures doesnt happen very often in real life!
Atomic Transactions
16
16
Atomic Transactions
17
17
Atomic Transactions
18
18
Atomic Transactions
19
19
Contact others
If any in Abort, then abort transaction
If any in Precommit, the move to Precommit state
Atomic Transactions
20
20
Atomic Transactions
21
21