DISTRIBUTED SYSTEM
CHAPTER 10 : CASE STUDY
LAB WORK SOLUTION- DISTRIBUTED SYSTEM
DISTRIBUTED SYSTEM -BCA -ALL SLIDES
MCQ- DISTRIBUTED SYSTEM

DISTRUBUTED SYSTEM NOTES,IOE, TU,BCA

LOGICAL CLOCK IN DISTRIBUTED SYSTEM

A logical clock in a distributed system is a mechanism used to order events and capture causality without relying on physical time. It helps in synchronizing events across different nodes to ensure a consistent and coherent sequence of operations. There are two main types of logical clocks: Lamport timestamps and vector clocks.

Lamports Logical Clock 

Lamport's Logical Clock is a mechanism used in distributed systems to order events in a way that respects causality, even when there is no global physical clock. This concept was introduced by Leslie Lamport in 1978 and plays a critical role in ensuring the consistency and coordination of distributed systems.

To synchronize logical clocks, Lamport defined a relation called happens-before.The expression a ->b is read as ‘a happens before b’ and means that all processes agree that event a occurs then event b occurs.From the definition of the happened-before relation, the clock condition mentioned above is satisfied if the following conditions hold:

  • i. If a and b are two events within the same process and a occurs before b  then a->b is true
  • Ii. If a is message sent by process and b is the receipt of that message by process then a->b is also true. 
  • A message cannot be received before it is sent , or even at the same time it is sent, since it takes finite, nonzero amount of time to arrive.

The algorithm follows some simple rules:

  • A process increments its counter before each event in that process.
  • When a process(a) sends a message to a process(b), it includes its counter value with the message.
  • On receiving a message, the counter of the recipient(b) is updated, if clock of receiver is less than clock of sender process: the receiver sets its local clock to c(b)=c(a)+1, where c(a) and c(b) are clock of process a and b repectively.
  • The counter is then incremented by 1 before the message is considered received.
  • Also each process adjust its clock to their respective interval.

A picture containing text, receipt

Description automatically generated