1 / 31

Lecture on Synchronization

Lecture on Synchronization. Submitted by WWW.ASSIGNMENTPOINT.COM. Clock Synchronization. When each machine has its own clock, an event that occurred after another event may nevertheless be assigned an earlier time. Physical Clocks (1). Computation of the mean solar day. Physical Clocks (2).

bpitt
Télécharger la présentation

Lecture on Synchronization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture on Synchronization Submitted by WWW.ASSIGNMENTPOINT.COM www.assignmentpoint.com

  2. Clock Synchronization When each machine has its own clock, an event that occurred after another event may nevertheless be assigned an earlier time. www.assignmentpoint.com

  3. Physical Clocks (1) Computation of the mean solar day. www.assignmentpoint.com

  4. Physical Clocks (2) TAI seconds are of constant length, unlike solar seconds. Leap seconds are introduced when necessary to keep in phase with the sun. www.assignmentpoint.com

  5. Clock Synchronization Algorithms The relation between clock time and UTC when clocks tick at different rates. www.assignmentpoint.com

  6. Cristian's Algorithm Getting the current time from a time server. www.assignmentpoint.com

  7. The Berkeley Algorithm • The time daemon asks all the other machines for their clock values • The machines answer • The time daemon tells everyone how to adjust their clock www.assignmentpoint.com

  8. Lamport Timestamps • Three processes, each with its own clock. The clocks run at different rates. • Lamport's algorithm corrects the clocks. www.assignmentpoint.com

  9. Example: Totally-Ordered Multicasting Updating a replicated database and leaving it in an inconsistent state. www.assignmentpoint.com

  10. Global State (1) • A consistent cut • An inconsistent cut www.assignmentpoint.com

  11. Global State (2) • Organization of a process and channels for a distributed snapshot www.assignmentpoint.com

  12. Global State (3) • 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 www.assignmentpoint.com

  13. The Bully Algorithm (1) 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 www.assignmentpoint.com

  14. Global State (3) • Process 6 tells 5 to stop • Process 6 wins and tells everyone www.assignmentpoint.com

  15. A Ring Algorithm Election algorithm using a ring. www.assignmentpoint.com

  16. Mutual Exclusion: A 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, when then replies to 2 www.assignmentpoint.com

  17. A Distributed Algorithm • Two processes 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. www.assignmentpoint.com

  18. A Toke Ring Algorithm • An unordered group of processes on a network. • A logical ring constructed in software. www.assignmentpoint.com

  19. Comparison A comparison of three mutual exclusion algorithms. www.assignmentpoint.com

  20. The Transaction Model (1) Updating a master tape is fault tolerant. www.assignmentpoint.com

  21. The Transaction Model (2) Examples of primitives for transactions. www.assignmentpoint.com

  22. The Transaction Model (3) • Transaction to reserve three flights commits • Transaction aborts when third flight is unavailable www.assignmentpoint.com

  23. Distributed Transactions • A nested transaction • A distributed transaction www.assignmentpoint.com

  24. 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 www.assignmentpoint.com

  25. Writeahead Log a) A transaction b) – d) The log before each statement is executed www.assignmentpoint.com

  26. Concurrency Control (1) General organization of managers for handling transactions. www.assignmentpoint.com

  27. Concurrency Control (2) General organization of managers for handling distributed transactions. www.assignmentpoint.com

  28. Serializability (d) a) – c) Three transactions T1, T2, and T3 d) Possible schedules www.assignmentpoint.com

  29. Two-Phase Locking (1) Two-phase locking. www.assignmentpoint.com

  30. Two-Phase Locking (2) Strict two-phase locking. www.assignmentpoint.com

  31. Pessimistic Timestamp Ordering Concurrency control using timestamps. www.assignmentpoint.com

More Related