Synchronization. Physical Clocks Solar Physical Clocks Cesium Clocks International Atomic Time...
-
date post
20-Dec-2015 -
Category
Documents
-
view
236 -
download
3
Transcript of Synchronization. Physical Clocks Solar Physical Clocks Cesium Clocks International Atomic Time...
Physical Clocks
• Solar Physical Clocks
• Cesium Clocks
• International Atomic Time
• Universal Coordinate Time (UTC)
• Clock Synchronization Algorithms– One machine is connected to WWV– No machine is receiving WWV time
Election Algorithms
• Many distributed systems require one process to act as coordinator
• Assume:– All processes are the same– Each process has a process number– Each process knows the process number of
every other process
The Bully Algorithm
• When a process P notices the coordinator is no longer responding it initiates and election– P sends ELECTION to every process with a
higher number– If no one responds P wins and becomes
coordinator– If one of the higher-numbered processes
responds then it takes over and P is done
Ring Algorithm
• The process noticing that the coordinator is not functioning builds an ELECTION message containing its process number and sends it its successor
• When the message gets back to the process that started it, its type is changed to COORDINATOR and sent around the ring
• The process with the largest number is elected.
Atomic Transactions
• A transaction is either committed completely or nothing is done (all-or-nothing)
• Sample tape based application
Atomic Transaction
• System consists of some number of independent processes
• Each process can fail at random
• Assume communication errors are handled by underlying software
Storage types
• Volatile RAM memory
• Disk storage
• Stable storage– Implemented using two or more disks– In case a failure, the second disk is used for
recovery
Properties of Transactions
• Serializability
Concurrent transactions do not interfere with each other
• Atomicity• To the outside world, the transaction happens
indivisibly
• Permanence• Once a transaction commits, the changes are
permanent
Nested Transactions
• The transactions can be contain sub-transactions
• Either all sub-transactions should commit or abort
• Each sub-transaction is given a private copy of data
Implementation
• Private Workspace– The copying is expensive– Optimizations for read and write are available
• No copy if no write is going on• Only copy the block list of files and update
modified blocks
Writeahead Log
• A list called an intension list or LOG is created with TransID, BlockNo, OldVal, NewVal fields
• After the log has been successfully written, the changes are made to the file
• In case of ABORT, the operation are reversed from last to first
Two Phase Commit
• Send each subordinate a message
• A subordinate responds when it is ready to commit
• If all subordinates are ready then commit else abort
Concurrency Control
• Locking– A process can lock a file before a transaction– Smaller piece of data can be lock for
efficiency (Granularity of locking)– Two phase locking (growing and shrinking)
can be used to avoid deadlocks and cascaded aborts
Optimistic concurrency Control
• Perform any transaction without considering other processes
• When committing the transaction, check if the files have been changed or not
• It is DeadLock Free
• In case of failure the transaction should re-run
Time stamp
• Assign a time stamp to each transaction at the moment it begins
• On committing check the orders– If orders true then commit – Else abort