SlideShare a Scribd company logo
DISTRIBUTED SYSTEM
Lamppost’s& vectors logical
clocks
BY-PINKI KUMARI SONI
LOGICAL CLOCK
• A logical clock is a mechanism for capturing chronological and causal
relationships in a distributed system. Distributed systems may have no
physically synchronous global clock, so a logical clock allows global
ordering on events from different processes in such systems.
• Note- chronological: the relation of a serial to its predecessors and successors
• Casual-Causation indicates that one event is the result of the occurrence of the other event;
i.e. there is a causal relationship between the two events.
LOGICAL CLOCK USE AND
ALGORITHMS
• Logical clocks are useful in computation analysis, distributed algorithm design,
individual event tracking, and exploring computational progress.
• Some noteworthy logical clock algorithms are:
• Lamport’s timestamps, which are monotonically increasing software counters.
• Vector clocks, that allow for partial ordering of events in a distributed system.
Timestamp-a digital record of the time of occurrence of a particular event.
LAMPORT’S
• Lamport’s clocks are a simple technique used for determining the order of
events in a distributed system.
• This clock was proposed by Leslie Lamport , a Lamport clock maintains order
of operations by incrementing a counter contained in the events
• By simply adding a counter value to events as they are received and
incrementing this value based on the last seen value,
• Lamport clocks provide a partial ordering of events – specifically “happened-
before” ordering.
LAMPORT’S ALGORITHM FOLLOWS
SOME SIMPLE RULES:
• A process increments its counter before each event in that process;
• When a process sends a message, it includes its counter value with the message;
• On receiving a message, the counter of the recipient is updated, if necessary, to the greater
of its current counter and the timestamp in the received message. The counter is then
incremented by 1 before the message is considered received.
The algorithm for sending:
• time = time+1;
• time_stamp = time;
• send(message, time_stamp);
The algorithm for reciving:
• (message, time_stamp) = receive();
• time = max(time_stamp, time)+1;
VECTOR CLOCK
• A vector clock is an algorithm for generating a partial ordering of events in a
distributed system and detecting causality violations. Just as in Lamport
timestamps, interprocess messages contain the state of the sending
process'slogical clock.
VECTOR CLOCK ALGORITHM
• Initially, all vectors [0,0,…,0]
• For event on process i, increment own ci
• Label message sent with local vector
• When process j receives message with vector [d1, d2, …, dn]:
• Set local each local entry k to max(ck, dk)
• Increment value of cj
IMPORTANT POINTS
• Physical Clocks
• Can keep closely synchronized, but never perfect
• Logical Clocks
• Encode causality relationship
• Lamport’s clocks provide only one-way encoding
• Vector clocks provide exact causality information
• Causality – If a b then event a can affect event b
• Concurrency – If neither a  b nor b a then one event cannot affect the other
• Partial Ordering – Causal events are sequenced
• Total Ordering – All events are sequenced
Distributed system lamport's and vector algorithm

More Related Content

What's hot

Communication primitives
Communication primitivesCommunication primitives
Communication primitives
Student
 
Lamport’s algorithm for mutual exclusion
Lamport’s algorithm for mutual exclusionLamport’s algorithm for mutual exclusion
Lamport’s algorithm for mutual exclusion
Neelamani Samal
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memoryAshish Kumar
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
Harshita Ved
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system model
Harshad Umredkar
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systemssumitjain2013
 
Resource management
Resource managementResource management
Resource management
Dr Sandeep Kumar Poonia
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems
DHIVYADEVAKI
 
Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computing
SVijaylakshmi
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems
Dr Sandeep Kumar Poonia
 
Heap Management
Heap ManagementHeap Management
Heap Management
Jenny Galino
 
Mobile transportlayer
Mobile transportlayerMobile transportlayer
Mobile transportlayerRahul Hada
 
Replication in Distributed Systems
Replication in Distributed SystemsReplication in Distributed Systems
Replication in Distributed Systems
Kavya Barnadhya Hazarika
 
Synchronization Pradeep K Sinha
Synchronization Pradeep K SinhaSynchronization Pradeep K Sinha
Synchronization Pradeep K Sinha
Jawwad Rafiq
 
Naming in Distributed Systems
Naming in Distributed SystemsNaming in Distributed Systems
Naming in Distributed Systems
Nandakumar P
 
Types of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemTypes of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed System
DHIVYADEVAKI
 
System models in distributed system
System models in distributed systemSystem models in distributed system
System models in distributed system
ishapadhy
 
Congestion avoidance in TCP
Congestion avoidance in TCPCongestion avoidance in TCP
Congestion avoidance in TCP
selvakumar_b1985
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
Alagappa Govt Arts College, Karaikudi
 
Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Sri Prasanna
 

What's hot (20)

Communication primitives
Communication primitivesCommunication primitives
Communication primitives
 
Lamport’s algorithm for mutual exclusion
Lamport’s algorithm for mutual exclusionLamport’s algorithm for mutual exclusion
Lamport’s algorithm for mutual exclusion
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system model
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systems
 
Resource management
Resource managementResource management
Resource management
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems
 
Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computing
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems
 
Heap Management
Heap ManagementHeap Management
Heap Management
 
Mobile transportlayer
Mobile transportlayerMobile transportlayer
Mobile transportlayer
 
Replication in Distributed Systems
Replication in Distributed SystemsReplication in Distributed Systems
Replication in Distributed Systems
 
Synchronization Pradeep K Sinha
Synchronization Pradeep K SinhaSynchronization Pradeep K Sinha
Synchronization Pradeep K Sinha
 
Naming in Distributed Systems
Naming in Distributed SystemsNaming in Distributed Systems
Naming in Distributed Systems
 
Types of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemTypes of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed System
 
System models in distributed system
System models in distributed systemSystem models in distributed system
System models in distributed system
 
Congestion avoidance in TCP
Congestion avoidance in TCPCongestion avoidance in TCP
Congestion avoidance in TCP
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)
 

Similar to Distributed system lamport's and vector algorithm

Synchronization
SynchronizationSynchronization
Synchronization
Ameena Tijjani
 
3. syncro. in distributed system
3. syncro. in distributed system3. syncro. in distributed system
3. syncro. in distributed system
Gd Goenka University
 
Lesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptxLesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptx
LagamaPasala
 
Shoaib
ShoaibShoaib
Shoaib
ShoaibShoaib
Clock.pdf
Clock.pdfClock.pdf
Clock.pdf
MohdAbdulHaque
 
Unit i
Unit iUnit i
Process scheduling & time
Process scheduling & timeProcess scheduling & time
Process scheduling & time
Yojana Nanaware
 
Unit iii-Synchronization
Unit iii-SynchronizationUnit iii-Synchronization
Unit iii-Synchronization
Dhivyaa C.R
 
Chapter 6 synchronization
Chapter 6 synchronizationChapter 6 synchronization
Physical and Logical Clocks
Physical and Logical ClocksPhysical and Logical Clocks
Physical and Logical Clocks
Dilum Bandara
 
Ch 1 overview
Ch 1 overviewCh 1 overview
Ch 1 overview
Er Ankita Kapoor
 
ppt2.pptx
ppt2.pptxppt2.pptx
ppt2.pptx
chere3
 
Synchronization in Distributed Systems.pptx
Synchronization in Distributed Systems.pptxSynchronization in Distributed Systems.pptx
Synchronization in Distributed Systems.pptx
RichardMathengeSPASP
 
Time advance mehcanism
Time advance mehcanismTime advance mehcanism
Time advance mehcanism
Nikhil Sharma
 
VTU 8th Sem Notes Simulation
VTU 8th Sem Notes SimulationVTU 8th Sem Notes Simulation
VTU 8th Sem Notes Simulation
Vivek Maurya
 

Similar to Distributed system lamport's and vector algorithm (20)

Synchronization
SynchronizationSynchronization
Synchronization
 
3. syncro. in distributed system
3. syncro. in distributed system3. syncro. in distributed system
3. syncro. in distributed system
 
Lesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptxLesson 05 - Time in Distrributed System.pptx
Lesson 05 - Time in Distrributed System.pptx
 
Synch
SynchSynch
Synch
 
Clocks
ClocksClocks
Clocks
 
Shoaib
ShoaibShoaib
Shoaib
 
Chap 5
Chap 5Chap 5
Chap 5
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Shoaib
ShoaibShoaib
Shoaib
 
Clock.pdf
Clock.pdfClock.pdf
Clock.pdf
 
Unit i
Unit iUnit i
Unit i
 
Process scheduling & time
Process scheduling & timeProcess scheduling & time
Process scheduling & time
 
Unit iii-Synchronization
Unit iii-SynchronizationUnit iii-Synchronization
Unit iii-Synchronization
 
Chapter 6 synchronization
Chapter 6 synchronizationChapter 6 synchronization
Chapter 6 synchronization
 
Physical and Logical Clocks
Physical and Logical ClocksPhysical and Logical Clocks
Physical and Logical Clocks
 
Ch 1 overview
Ch 1 overviewCh 1 overview
Ch 1 overview
 
ppt2.pptx
ppt2.pptxppt2.pptx
ppt2.pptx
 
Synchronization in Distributed Systems.pptx
Synchronization in Distributed Systems.pptxSynchronization in Distributed Systems.pptx
Synchronization in Distributed Systems.pptx
 
Time advance mehcanism
Time advance mehcanismTime advance mehcanism
Time advance mehcanism
 
VTU 8th Sem Notes Simulation
VTU 8th Sem Notes SimulationVTU 8th Sem Notes Simulation
VTU 8th Sem Notes Simulation
 

Recently uploaded

Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 

Recently uploaded (20)

Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 

Distributed system lamport's and vector algorithm

  • 1. DISTRIBUTED SYSTEM Lamppost’s& vectors logical clocks BY-PINKI KUMARI SONI
  • 2. LOGICAL CLOCK • A logical clock is a mechanism for capturing chronological and causal relationships in a distributed system. Distributed systems may have no physically synchronous global clock, so a logical clock allows global ordering on events from different processes in such systems. • Note- chronological: the relation of a serial to its predecessors and successors • Casual-Causation indicates that one event is the result of the occurrence of the other event; i.e. there is a causal relationship between the two events.
  • 3.
  • 4. LOGICAL CLOCK USE AND ALGORITHMS • Logical clocks are useful in computation analysis, distributed algorithm design, individual event tracking, and exploring computational progress. • Some noteworthy logical clock algorithms are: • Lamport’s timestamps, which are monotonically increasing software counters. • Vector clocks, that allow for partial ordering of events in a distributed system. Timestamp-a digital record of the time of occurrence of a particular event.
  • 5. LAMPORT’S • Lamport’s clocks are a simple technique used for determining the order of events in a distributed system. • This clock was proposed by Leslie Lamport , a Lamport clock maintains order of operations by incrementing a counter contained in the events • By simply adding a counter value to events as they are received and incrementing this value based on the last seen value, • Lamport clocks provide a partial ordering of events – specifically “happened- before” ordering.
  • 6. LAMPORT’S ALGORITHM FOLLOWS SOME SIMPLE RULES: • A process increments its counter before each event in that process; • When a process sends a message, it includes its counter value with the message; • On receiving a message, the counter of the recipient is updated, if necessary, to the greater of its current counter and the timestamp in the received message. The counter is then incremented by 1 before the message is considered received. The algorithm for sending: • time = time+1; • time_stamp = time; • send(message, time_stamp); The algorithm for reciving: • (message, time_stamp) = receive(); • time = max(time_stamp, time)+1;
  • 7.
  • 8. VECTOR CLOCK • A vector clock is an algorithm for generating a partial ordering of events in a distributed system and detecting causality violations. Just as in Lamport timestamps, interprocess messages contain the state of the sending process'slogical clock.
  • 9. VECTOR CLOCK ALGORITHM • Initially, all vectors [0,0,…,0] • For event on process i, increment own ci • Label message sent with local vector • When process j receives message with vector [d1, d2, …, dn]: • Set local each local entry k to max(ck, dk) • Increment value of cj
  • 10.
  • 11. IMPORTANT POINTS • Physical Clocks • Can keep closely synchronized, but never perfect • Logical Clocks • Encode causality relationship • Lamport’s clocks provide only one-way encoding • Vector clocks provide exact causality information • Causality – If a b then event a can affect event b • Concurrency – If neither a  b nor b a then one event cannot affect the other • Partial Ordering – Causal events are sequenced • Total Ordering – All events are sequenced