SlideShare a Scribd company logo
1 of 12
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

Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)
Sri Prasanna
 

What's hot (20)

Physical and Logical Clocks
Physical and Logical ClocksPhysical and Logical Clocks
Physical and Logical Clocks
 
Message and Stream Oriented Communication
Message and Stream Oriented CommunicationMessage and Stream Oriented Communication
Message and Stream Oriented Communication
 
Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)Clock Synchronization (Distributed computing)
Clock Synchronization (Distributed computing)
 
Distributed deadlock
Distributed deadlockDistributed deadlock
Distributed deadlock
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
6.Distributed Operating Systems
6.Distributed Operating Systems6.Distributed Operating Systems
6.Distributed Operating Systems
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
 
Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computing
 
Vector clock algorithm
Vector clock algorithmVector clock algorithm
Vector clock algorithm
 
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
 
Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...
Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...
Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...
 
Locks In Disributed Systems
Locks In Disributed SystemsLocks In Disributed Systems
Locks In Disributed Systems
 
Communications is distributed systems
Communications is distributed systemsCommunications is distributed systems
Communications is distributed systems
 
Link state routing protocol
Link state routing protocolLink state routing protocol
Link state routing protocol
 
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
 
Lamport’s algorithm for mutual exclusion
Lamport’s algorithm for mutual exclusionLamport’s algorithm for mutual exclusion
Lamport’s algorithm for mutual exclusion
 
Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
 
Middleware
MiddlewareMiddleware
Middleware
 
Sliding window protocol
Sliding window protocolSliding window protocol
Sliding window protocol
 

Similar to Distributed system lamport's and vector algorithm

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
 
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
 
Chapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.pptChapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.ppt
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

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