Synchronisation - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

Synchronisation

Description:

Leap seconds are introduced when necessary to keep in phase with the sun. ... The time daemon tells everyone how to adjust their clock. Lamport Timestamps ... – PowerPoint PPT presentation

Number of Views:97
Avg rating:3.0/5.0
Slides: 33
Provided by: stevear
Category:

less

Transcript and Presenter's Notes

Title: Synchronisation


1
Synchronisation
  • Chapter 5

2
Clock Synchronisation
  • When each machine has its own clock, an event
    that occurred after another event may
    nevertheless be assigned an earlier time.

3
Physical Clocks (1)
  • Computation of the mean solar day.

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.

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

6
Cristian's Algorithm
  • Getting the current time from a time server.

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

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

9
Example Totally-Ordered Multicasting
  • Updating a replicated database and leaving it in
    an inconsistent state.

10
Global State (1)
  • A consistent cut
  • An inconsistent cut

11
Global State (2)
  • Organisation of a process and channels for a
    distributed snapshot

12
Global State (3)
  • Process Q receives a marker for the first time
    and records its local state (and sends out a
    marker on its outgoing channels)
  • Q records all incoming messages
  • Q receives a marker for its incoming channel and
    finishes recording the state of the incoming
    channel

13
The Bully Algorithm (1)
  • The bully election algorithm to elect a
    coordinator
  • Process 4 holds an election
  • Process 5 and 6 respond, telling 4 to stop
  • Now 5 and 6 each hold an election

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

15
A Ring Algorithm
  • Election algorithm using a ring.

16
Mutual Exclusion A Centralised 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

17
A Distributed Algorithm
  • Two processes (0 and 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.

18
A Token Ring Algorithm
  • An unordered group of processes on a network.
  • A logical ring constructed in software.

19
Comparison
  • A comparison of three mutual exclusion algorithms.

20
The Transaction Model (1)
  • Updating a master tape is fault tolerant.

21
The Transaction Model (2)
  • Examples of primitives for transactions.

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

23
Transaction Properties
  • Atomic
  • To the outside world, the transaction happens
    indivisibly
  • Consistent
  • The transaction does not violate the system
    invariants
  • Isolated
  • Concurrent transactions do not interfere
  • Transactions are serializable
  • Durable
  • Once a transaction commits, the changes are
    permanent

24
Distributed Transactions
  • A nested transaction
  • A distributed transaction

25
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 (copy on write)
  • After committing

26
Writeahead Log
  • a) A transaction
  • b) d) The log before each statement is executed

27
Concurrency Control (1)
  • General organisation of managers for handling
    transactions.

28
Concurrency Control (2)
  • General organization of managers for handling
    distributed transactions.

29
Serializability
(d)
  • a) c) Three transactions T1, T2, and T3
  • d) Possible schedules

30
Two-Phase Locking (1)
  • Two-phase locking.

31
Two-Phase Locking (2)
  • Strict two-phase locking.

32
Pessimistic Timestamp Ordering
  • Concurrency control using timestamps.
Write a Comment
User Comments (0)
About PowerShow.com