7 views

Uploaded by Buster Vester

- ipc
- gps-st22
- 04304268
- High Precision GPS Guidance of Mobile Robots
- pdf
- GPS622R - Data sheet
- 9781784391324_Apache_ZooKeeper_Essentials_Sample_Chapter
- A11 Clocks -Synch1
- DigiTrainer Manual 2.00 ENG
- Prototype Testing
- Deadlock
- TTT Accugrade Specalog
- Tutorial 6
- National Instruments GPS Rx Testing Tutorial
- HOUSE HEARING, 111TH CONGRESS - GPS: CAN WE AVOID A GAP IN SERVICE?
- A Comparative Study on Spectral Analysis of Global Navigation Satellite Systems
- Location Based Services (LBS) for Searching Tire Repair Location in Banjarbaru City Based on Android
- Pteryx Mapping Secrets
- Efficient Synchronization for Distributed Embedded Multiprocessors - 2016
- RNAV Approaches

You are on page 1of 13

VU Amsterdam, Dept. Computer Science Room R4.20, steen@cs.vu.nl

Version: November 16, 2009

1 / 39

Contents

Chapter 01: Introduction 02: Architectures 03: Processes 04: Communication 05: Naming 06: Synchronization 07: Consistency & Replication 08: Fault Tolerance 09: Security 10: Distributed Object-Based Systems 11: Distributed File Systems 12: Distributed Web-Based Systems 13: Distributed Coordination-Based Systems

2 / 39 2 / 39

Distributed Algorithms

Distributed Algorithms

Clock Synchronization

3 / 39

3 / 39

Distributed Algorithms

Distributed Algorithms

Physical clocks

Problem Sometimes we simply need the exact time, not just an ordering. Solution Universal Coordinated Time (UTC): Based on the number of transitions per second of the cesium 133 atom (pretty accurate). At present, the real time is taken as the average of some 50 cesium-clocks around the world. Introduces a leap second from time to time to compensate that days are getting longer. Note UTC is broadcast through short wave radio and satellite. Satellites can give an accuracy of about 0.5 ms.

4 / 39 4 / 39

Distributed Algorithms

Distributed Algorithms

Physical clocks

Problem Suppose we have a distributed system with a UTC-receiver somewhere in it we still have to distribute its time to each machine. Basic principle Every machine has a timer that generates an interrupt H times per second. There is a clock in machine p that ticks on each timer interrupt. Denote the value of that clock by Cp (t), where t is UTC time. Ideally, we have that for each machine p, Cp (t) = t, or, in other words, dC/dt = 1.

5 / 39

5 / 39

Distributed Algorithms

Distributed Algorithms

Physical clocks

dC >1 dt

loc k tc

Clock time, C

cl

w Slo clo

oc k

dC =1 dt dC <1 ck dt

Fa s

In practice: 1

dC dt

1 + .

Goal Never let two clocks in any system differ by more than time units synchronize at least every /(2) seconds.

6 / 39 6 / 39

Pe

UTC, t

rfe ct

Distributed Algorithms

Distributed Algorithms

Basic idea You can get an accurate account of time as a side-effect of GPS.

x r = 10

7 / 39

7 / 39

Distributed Algorithms

Distributed Algorithms

Problem Assuming that the clocks of the satellites are accurate and synchronized: It takes a while before a signal reaches the receiver The receivers clock is denitely out of synch with the satellite

8 / 39

8 / 39

Distributed Algorithms

Distributed Algorithms

Principal operation r : unknown deviation of the receivers clock. xr , yr , zr : unknown coordinates of the receiver. Ti : timestamp on a message from satellite i i = (Tnow Ti ) + r : measured delay of the message sent by satellite i. Measured distance to satellite i: c i (c is speed of light) Real distance is di = ci cr = Observation 4 satellites 4 equations in 4 unknowns (with r as one of them)

9 / 39 9 / 39

Distributed Algorithms

Distributed Algorithms

Principle I Every machine asks a time server for the accurate time at least once every /(2) seconds (Network Time Protocol). Note Okay, but you need an accurate measure of round trip delay, including interrupt handling and processing incoming messages.

10 / 39

10 / 39

Distributed Algorithms

Distributed Algorithms

Principle II Let the time server scan all machines periodically, calculate an average, and inform each machine how it should adjust its time relative to its present time. Note Okay, youll probably get every machine in sync. You dont even need to propagate UTC time. Fundamental Youll have to take into account that setting the time back is never allowed smooth adjustments.

11 / 39

11 / 39

Distributed Algorithms

Distributed Algorithms

Problem We rst need to introduce a notion of ordering before we can order anything. The happened-before relation If a and b are two events in the same process, and a comes before b, then a b. If a is the sending of a message, and b is the receipt of that message, then a b If a b and b c, then a c Note This introduces a partial ordering of events in a system with concurrently operating processes.

12 / 39 12 / 39

Distributed Algorithms

Distributed Algorithms

Logical clocks

Problem How do we maintain a global view on the systems behavior that is consistent with the happened-before relation? Solution Attach a timestamp C(e) to each event e, satisfying the following properties: P1 If a and b are two events in the same process, and a b, then we demand that C(a) < C(b). P2 If a corresponds to sending a message m, and b to the receipt of that message, then also C(a) < C(b). Problem How to attach a timestamp to an event when theres no global clock maintain a consistent set of logical clocks, one per process.

13 / 39 13 / 39

Distributed Algorithms

Distributed Algorithms

Logical clocks

Solution Each process Pi maintains a local counter Ci and adjusts this counter according to the following rules: 1: For any two successive events that take place within Pi , Ci is incremented by 1. 2: Each time a message m is sent by process Pi , the message receives a timestamp ts(m) = Ci . 3: Whenever a message m is received by a process Pj , Pj adjusts its local counter Cj to max{Cj , ts(m)}; then executes step 1 before passing m to the application. Notes Property P1 is satised by (1); Property P2 by (2) and (3). It can still occur that two events happen at the same time. Avoid this by breaking ties through process IDs.

14 / 39 14 / 39

Distributed Algorithms

Distributed Algorithms

P1 0 6 12 18 24 30 36 42 48 54 60

m1

m4

P2 0 8 16 24 32 40 48 56 64 72 80 (a)

m2

m3

P3 0 10 20 30 40 50 60 70 80 90 100

P2 0 8 16 24 32 40 48 61 69 77 85 (b)

m2

m3

P3 0 10 20 30 40 50 60 70 80 90 100

15 / 39

15 / 39

Distributed Algorithms

Distributed Algorithms

Note Adjustments take place in the middleware layer

Application layer

Middleware layer

Message is received

Network layer

16 / 39

16 / 39

Distributed Algorithms

Distributed Algorithms

Problem We sometimes need to guarantee that concurrent updates on a replicated database are seen in the same order everywhere: P1 adds $100 to an account (initial value: $1000) P2 increments account by 1% There are two replicas

Update 1 Update 2

Replicated database

17 / 39 17 / 39

Distributed Algorithms

Distributed Algorithms

Solution Process Pi sends timestamped message msgi to all others. The message itself is put in a local queue queuei . Any incoming message at Pj is queued in queuej , according to its timestamp, and acknowledged to every other process. Pj passes a message msgi to its application if: (1) msgi is at the head of queuej (2) for each process Pk , there is a message msgk in queuej with a larger timestamp. Note We are assuming that communication is reliable and FIFO ordered.

18 / 39

18 / 39

Distributed Algorithms

Distributed Algorithms

Vector clocks

Observation Lamports clocks do not guarantee that if C(a) < C(b) that a causally preceded b

P1 0 6 12 18 24 30 36 42 48 70 76 P2 0 8 16 24 32 40 48 61 69 77 85 P3 0 10 20 30 40 50 60 70 80 90 100

m1

m2 m3

m4

m5

19 / 39 19 / 39

Distributed Algorithms

Distributed Algorithms

Vector clocks

Solution Each process Pi has an array VCi [1..n], where VCi [j] denotes the number of events that process Pi knows have taken place at process Pj . When Pi sends a message m, it adds 1 to VCi [i], and sends VCi along with m as vector timestamp vt(m). Result: upon arrival, recipient knows Pi s timestamp. When a process Pj delivers a message m that it received from Pi with vector timestamp ts(m), it (1) updates each VCj [k ] to max{VCj [k ], ts(m)[k]} (2) increments VCj [j] by 1. Question What does VCi [j] = k mean in terms of messages sent and received?

20 / 39 20 / 39

Distributed Algorithms

Distributed Algorithms

Observation We can now ensure that a message is delivered only if all causally preceding messages have already been delivered. Adjustment Pi increments VCi [i] only when sending a message, and Pj adjusts VCj when receiving a message (i.e., effectively does not change VCj [j]). Pj postpones delivery of m until: ts(m)[i] = VCj [i] + 1. ts(m)[k ] VCj [k] for k = i.

21 / 39

21 / 39

Distributed Algorithms

Distributed Algorithms

Example

P0 VC0 = (1,0,0) m P1 VC1 = (1,1,0) P2 VC 2= (0,0,0) VC2 = (1,0,0) VC0 = (1,1,0)

m* VC2 = (1,1,0)

Example Take VC2 = [0, 2, 2], ts(m) = [1, 3, 0] from P0 . What information does P2 have, and what will it do when receiving m (from P0 )?

22 / 39

22 / 39

Distributed Algorithms

Distributed Algorithms

Mutual exclusion

Problem A number of processes in a distributed system want exclusive access to some resource. Basic solutions Via a centralized server. Completely decentralized, using a peer-to-peer system. Completely distributed, with no topology imposed. Completely distributed along a (logical) ring.

23 / 39

23 / 39

Distributed Algorithms

Distributed Algorithms

0 Request

1 OK 3

1 Request

2 OK

Release No reply 3

Coordinator (a)

Queue is empty

(b)

(c)

24 / 39

24 / 39

Distributed Algorithms

Distributed Algorithms

Principle Assume every resource is replicated n times, with each replica having its own coordinator access requires a majority vote from m > n/2 coordinators. A coordinator always responds immediately to a request. Assumption When a coordinator crashes, it will recover quickly, but will have forgotten about permissions it had granted.

25 / 39

25 / 39

Distributed Algorithms

Distributed Algorithms

Issue How robust is this system? Let p = t/T denote the probability that a coordinator crashes and recovers in a period t while having an average lifetime T probability that k out m coordinators reset: P[violation] = pv =

k=2mn

m k p (1 p)mk k

26 / 39

26 / 39

Distributed Algorithms

Distributed Algorithms

Principle The same as Lamport except that acknowledgments arent sent. Instead, replies (i.e. grants) are sent only when The receiving process has no interest in the shared resource; or The receiving process is waiting for the resource, but has lower priority (known through comparison of timestamps). In all other cases, reply is deferred, implying some more local administration.

8 0 8 8 1 12 (a) 2 12 1 OK (b) 2 1 2 12 OK Accesses resource 0 OK 0 OK Accesses resource

(c)

27 / 39 27 / 39

Distributed Algorithms

Distributed Algorithms

Essence Organize processes in a logical ring, and let a token be passed between them. The one that holds the token is allowed to enter the critical region (if it wants to).

2 1 3

7 6 (a) (b)

28 / 39

28 / 39

Distributed Algorithms

Distributed Algorithms

Delay 2 2m 2 (n 1) 0 to n 1

Problems Coordinator crash Starvation, low eff. Crash of any process Lost token, proc. crash

29 / 39

29 / 39

Distributed Algorithms

Distributed Algorithms

Problem How can a single node efciently estimate the latency between any two other nodes in a distributed system? Solution Construct a geometric overlay network, in which the distance d(P, Q) reects the actual latency between P and Q.

30 / 39

30 / 39

Distributed Algorithms

Distributed Algorithms

Computing position

Observation A node P needs k + 1 landmarks to compute its own position in a d-dimensional space. Consider two-dimensional case.

(x 2 ,y2 ) d2 d1 d3 (x 3 ,y3 ) P

(x 1 ,y1 )

di =

(xi xP )2 + (yi yP )2

31 / 39

31 / 39

Distributed Algorithms

Distributed Algorithms

Computing position

Problems measured latencies to landmarks uctuate computed distances will not even be consistent: Solution Let the L landmarks measure their pairwise latencies d(bi , bj ) and let each node P minimize L d(b , P) d(b , P) [ i d(bi , P) i ]2 i =1 where d(bi , P) denotes the distance to landmark bi given a computed coordinate for P.

32 / 39 32 / 39

1 P

2 Q

4 R

Distributed Algorithms

Distributed Algorithms

Election algorithms

Principle An algorithm requires that some process acts as a coordinator. The question is how to select this special process dynamically. Note In many systems the coordinator is chosen by hand (e.g. le servers). This leads to centralized solutions single point of failure. Question If a coordinator is chosen dynamically, to what extent can we speak about a centralized or distributed solution? Question Is a fully distributed solution, i.e. one without a coordinator, always more robust than any centralized/coordinated solution?

33 / 39 33 / 39

Distributed Algorithms

Distributed Algorithms

Election by bullying

Principle Each process has an associated priority (weight). The process with the highest priority should always be elected as the coordinator. Issue How do we nd the heaviest process? Any process can just start an election by sending an election message to all other processes (assuming you dont know the weights of the others). If a process Pheavy receives an election message from a lighter process Plight , it sends a take-over message to Plight . Plight is out of the race. If a process doesnt get a take-over message back, it wins, and sends a victory message to all other processes.

34 / 39

34 / 39

Distributed Algorithms

Distributed Algorithms

Election by bullying

1 2

cti Ele on

1 5 2

OK

1 5 2

Ele ctio n

5 Election

Election

OK

6

tio n

3 7

0 7

El ec

Election in a ring

Principle Process priority is obtained by organizing processes into a (logical) ring. Process with the highest priority should be elected as coordinator. Any process can start an election by sending an election message to its successor. If a successor is down, the message is passed on to the next successor. If a message is passed on, the sender adds itself to the list. When it gets back to the initiator, everyone had a chance to make its presence known. The initiator sends a coordinator message around the ring containing a list of all living processes. The one with the highest priority is elected as coordinator.

36 / 39 36 / 39

El ec tio n

(a) 2 4 0 7 (d) 0 7 Previous coordinator has crashed (b) 1 5 OK 6 4 Coordinator 6 2 1 5 3 0 7 (e) 3

(c)

35 / 39

35 / 39

Distributed Algorithms

Distributed Algorithms

Distributed Algorithms

Distributed Algorithms

Election in a ring

Question Does it matter if two processes initiate an election? Question What happens if a process crashes during the election?

37 / 39

37 / 39

Distributed Algorithms

Distributed Algorithms

Superpeer election

Issue How can we select superpeers such that: Normal nodes have low-latency access to superpeers Superpeers are evenly distributed across the overlay network There is be a predened fraction of superpeers Each superpeer should not need to serve more than a xed number of normal nodes

38 / 39

38 / 39

Distributed Algorithms

Distributed Algorithms

Superpeer election

DHTs Reserve a xed part of the ID space for superpeers. Example if S superpeers are needed for a system that uses m-bit identiers, simply reserve the k = log2 S leftmost bits for superpeers. With N nodes, well have, on average, 2km N superpeers. Routing to superpeer Send message for key p to node responsible for p AND 11 1100 00

39 / 39

39 / 39

- ipcUploaded byOlcum Cetinkaya
- gps-st22Uploaded bywizardgrt1
- 04304268Uploaded byUmai Balan
- High Precision GPS Guidance of Mobile RobotsUploaded byJatin Chaudhari
- pdfUploaded bySzefong Chiew
- GPS622R - Data sheetUploaded byGabriele Titomanlio
- 9781784391324_Apache_ZooKeeper_Essentials_Sample_ChapterUploaded byPackt Publishing
- A11 Clocks -Synch1Uploaded byRitesh Sharma
- DigiTrainer Manual 2.00 ENGUploaded bygeorgel22000
- Prototype TestingUploaded byLawrence Bognot
- DeadlockUploaded byAriBoyka
- TTT Accugrade SpecalogUploaded bylocalbook
- Tutorial 6Uploaded byAnurag Tiwari
- National Instruments GPS Rx Testing TutorialUploaded byHendra Lesmana
- HOUSE HEARING, 111TH CONGRESS - GPS: CAN WE AVOID A GAP IN SERVICE?Uploaded byScribd Government Docs
- A Comparative Study on Spectral Analysis of Global Navigation Satellite SystemsUploaded byIAEME Publication
- Location Based Services (LBS) for Searching Tire Repair Location in Banjarbaru City Based on AndroidUploaded byDesy Ika
- Pteryx Mapping SecretsUploaded byUncondemning Monk
- Efficient Synchronization for Distributed Embedded Multiprocessors - 2016Uploaded bymtechprojects
- RNAV ApproachesUploaded byRudi Widioko
- Gps 1Uploaded byEduardo Acosta
- cardenas_the_transborder_immigrant_tool.pdfUploaded byTainá Louven
- E164 PSTN LayoutUploaded byJimmy Godoy Vega
- GPS Re Transmission Inside Military Ground Vehicles-Jyoti ElectronicsUploaded byRajendra Agarwal
- 2 Environmental Epidemiology.pptUploaded byRatna Ismail
- major ppt (1)Uploaded byaravind pesaru
- Context Aware Systems - Seminar PresentationUploaded bytechiewickie
- Location Based Encryption-Decryption Approach for Data SecurityUploaded byATS
- CS2056-Distributed Systems Analysis and RememberingUploaded byNithiBoaz
- Vehicle GPS Tracker User Manual VT-108Uploaded byRos Ortega Lopez

- Backstrom_ingmar_09038-Performance Measurement of IP Networks Using TWAMPUploaded byCarlos Prieto
- Module2_WSN_SRINIVASUploaded bySrinivas Devulapalli
- NotesUploaded byMohammad Zaheer
- RUNCLUVFYUploaded byshaikali1980
- 8_0_C4_STD_Iss3_0_06Apr12.pdfUploaded byHarry
- DS External QuestionsUploaded bysanthosh.iyengar
- Huawei LTE ENodeB CabinetsUploaded bySyed Mohsin Ghani
- 10-TimeUploaded bySelect dsouza
- Notes.06Uploaded byBuster Vester
- Energy Efficient Recognition Protocol for Ad Hoc NetworksUploaded byijcses
- NET 4010 Process Synchronization(1)Uploaded byElijah Mwangi
- 2014-04Uploaded byRajendra Kumar
- Technical Guide to SRAN Network Design (GO Applicable to SRAN10.0 & GBSS17.0 & BSC6910)-20140902-A-1.0Uploaded byLee Nghia
- Distributed Computing notesUploaded byapi-26355935
- Clock SynchronizationUploaded bySparsh Gupta
- Gradient Clock SynchronizationUploaded byuks
- 3bse035982-510 - En Ac 800m 5.1 Communication ProtocolsUploaded byNguyễn Anh Tú
- 04077944.pdfUploaded byopenid_AePkLAJc
- GPS DCS Time SyhchronisationUploaded bykoushik42000
- Chapter 3Uploaded byMichel Mendoza
- IP RAN Planning BasicsUploaded bytaufiqibrahim
- Case Study National GridUploaded byinfinitiav
- GMAC Clock Synch ModellingUploaded bypickman89
- D.S synchronisationUploaded byMarvin Njenga
- Exactly-Once Semantics in a Replicated Messaging SystemUploaded byDeepankar Patra
- EnodeB Demo.2.1Uploaded byGauravSwami
- BTS GPS Synchronization(GBSS15.0_02)Uploaded byWael Alkodami
- Christian AlgorithmUploaded bykamikazi3
- Wimesh ProposalUploaded bypiramanayagam
- MC0085Uploaded bysamir_sofy