SlideServe
Menu
Préférences
© SlideServe · v2026

Synchronization and Clock Algorithms in Distributed Systems

cranec avatar
23 diapositives · 390 Views · Jan 04, 2020

Explore clock synchronization, distributed algorithms, logical clocks, and mutual exclusion in distributed systems. Learn about centralized and decentralized approaches, NTP protocol, Lamport and Vector timestamps, global state capture, and mutual exclusion algorithms. Dive into distributed transactions, transaction models, private workspaces, write-ahead logging, and concurrency control.

Synchronization and Clock Algorithms in Distributed Systems - slide 1
01 / 23Synchronization and Clock Algorithms in Distributed Systems
1 / 17

Télécharger la présentation

Synchronization and Clock Algorithms in Distributed Systems
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Synchronization

  2. Clock SynchronizationIn a centralized system time is unambiguous.In a distributed system agreement on time is not obvious. • When each machine has its own clock, an event that occurred after another event maybe assigned an earlier time.

  3. Clock Synchronization Algorithms If 1 – r < dC/dt < 1 + r r maximum drift rate Resynchronization interval d/2r d maximum time difference • The relation between clock time and UTC when clocks tick at different rates.

  4. Cristian's Algorithmsynchronization with a time server • Time must never run backward gradual changes • Non zero message propagation time

  5. The Berkeley Algorithmsynchronization without time server • The machines answer • The time daemon asks all the other machines for their clock values • The time daemon tells everyone how to adjust their clock • no Universal Coordinated Time available

  6. Centralized algorithms have disadvantages. • Decentralized algorithms can use averaging methods. • NTP (Network Time Protocol) provides an accuracy of 1-50 msec using advanced algorithms. • For many purposes it is sufficient that all machines agree on the same time. • Logical clocks

  7. Lamport Timestamps If a b C(a) < C(b) If a sen., b rec. C(a) < C(b) C(a)  C(b) If C(a) < C(b) C(a) = C(b)+1 We obtain a total ordering of all events in the system Lamport timestamps don’t capture causality Vector timestamps

  8. Global Stateit is the local state of each process, together with the messages currently in transita distributed snapshot reflects a consistent global state

  9. Global State any process P may initiate the algorithm recording its local state. • Organization of a process and channels for a distributed snapshot • A process P sends a marker along each of its outgoing channels

  10. Global State • Process Q receives a marker for the first time and records its local state • Q records all incoming message • Q receives a marker for its incoming channel and finishes recording the state of the incoming channel • A process has finished its part of the algorithm when it has received a marker along each of its incoming channels, and processed each one. • Many snapshots may be in progress at the same time.

  11. The Bully Algorithm Selecting a coordinator • The bully election algorithm • Process 4 holds an election • Process 5 and 6 respond, telling 4 to stop • Now 5 and 6 each hold an election

  12. Process 6 tells 5 to stop • Process 6 wins and tells everyone

  13. Mutual Exclusion:critical regions in distributed systemsA Centralized Algorithm • Process 1 asks the coordinator for permission to enter a critical region. Permission is granted • Process 2 then asks permission to enter the same critical region. The coordinator does not reply. • When process 1 exits the critical region, it tells the coordinator, which then replies to 2

  14. A Distributed Algorithmrequires a total ordering of all events in the system • Two processes (0,2) want to enter the same critical region at the same moment. • Process 0 has the lowest timestamp, so it wins. • When process 0 is done, it sends an OK also, so 2 can now enter the critical region. • This algorithm is worse than the centralized one, but possible

  15. A Toke Ring Algorithm start • An unordered group of processes on a network. • A logical ring constructed in software.

  16. Comparison • A comparison of three mutual exclusion algorithms.

  17. The Transaction Model A transaction permits that a whole set of related instructionswould be successfully completed or none would be completed.Special primitives are requested • Examples of primitives for transactions.

  18. The Transaction Model • Transactions are ACID: • Atomic : to outside, they happen indivisibly • Consistent : they don’t violate system invariants • Isolated : concurrent transactions don’t interfere • Durable : the changes are permanent

  19. Distributed Transactions • A nested transaction (it follows a logical division of the work) • A distributed transaction (it is logically flat and operates on distributed data)

  20. Private Workspace • The file index and disk blocks for a three-block file • The situation after a transaction has modified block 0 and appended block 3 • After committing

  21. Writeahead Log rollback • a) A transaction • b) – d) The log before each statement is executed • In distributed systems each machine keeps its own log of changes to its local file system

  22. Concurrency Control allows several transaction to be executed simultaneously leaving data in a consistent way • General organization of managers for handling transactions.

  23. Concurrency Control • General organization of managers for handling distributed transactions.