1
$\begingroup$

This is the example

I have asked 1 type of question but I have asked that in many questions. So bear with me. My question is about 1 topic, I just didn't find it right to create separate questions for each of these questions so I am asking like this-:

The Lamport logical clock algorithm is-:

at pi : before each event Li= Li + 1 when pi sends a message m to pj

  1. pi: ( Li = Li + 1 ); t = Li ; message = (m, t) ;
  2. pj: Lj = max(Lj, t); Lj= Lj+ 1;
  3. Lj (receive event) = Lj ;

Here is my question-:

A) p1->p2-:

Here we have message m1.

Lj=max(6,16)=16

Q1) Now We need to do Lj=Lj+1 isn't it according to the algorithm? So Lj=17 isn't it??

Then B) p2->p3

For m2-:

Lj=max(24,40)=40

Q2) Lj=Lj+1=41. Isn't it? Why are we not doing it?

C) p3->p2

For m3-: Lj=max(60,56)=60

Lj=Lj+1=61

Q3) But why did we updated 64 to 69, 72 to 77 and 80 to 85 in P2? Which part of Lamport's logical clock is happening here?

d) p2->p1-:

For m4-:

Lj=max(54,69)=69

Lj=Lj+1=70

Q4) But why did we updated 60 to 76? Which part of algorithm are we following here?

$\endgroup$
1
  • $\begingroup$ Only one question per post, please. $\endgroup$
    – D.W.
    Sep 8 at 6:46