Download presentation

Presentation is loading. Please wait.

Published byGracie Killman Modified over 3 years ago

1
P1 P2 P3 x y z (0,0,0) M1 M2 M3 VP1( __, __ ) VP2( __, __ ) VP3( __, __ ) Initially Vector Time is (0,0,0) at all sites Vector at each site is empty. Note here we have taken size of vector at each site as 2. If You want you can extend it easily upto 3. Figure 1 a b

2
Vectors Maintained at each site VP1 ( __, __ ) This entry gets updated when P1 sends any Message to P2 This entry gets updated when P1 sends any Message to P3 VP2 ( __, __ ) This entry gets updated when P2 sends any Message to P1 This entry gets updated when P2 sends any Message to P3 VP3 ( __, __ ) This entry gets updated when P3 sends any Message to P1 This entry gets updated when P3 sends any Message to P2

3
Consider Sending of Message M1 from P2 to P1 of Figure 1 Send Step at P2 1.P2 Sends Message M1 to P1 [ Vector accompanying Message will be represented as VM ( __, __) i.e. empty ]. So P2 sends the Message {( __, __), (0,1,0)} to P1. 2.After Sending Message it updates its own vector VP2. Now P1’s corresponding entry in VP2 (i.e. Vector of Process P2) is empty so the pair {P1,(0,1,0)} will be inserted in VP2. So before sending message M1, VP2 is ( __,__) but after sending message M1, P2’s vector VP2 will be updated as {(P1,(0,1,0)), __)}. Important Point : Message M1 is sent with Earlier VP2 (as VM )i.e. VP2 existing at P2 before sending message M1. VP2 gets updated with new entry after sending Message M1.

4
Receiving of M1 by P1 at Point y of Figure Receiving of M1 by P1[Note here what P1 has received from P2. Message of form {( __, __), (0,1,0)} i.e. (VM,t). Check 1.If the Accompanying VM contains any entry corresponding to P1, If not receive the message. [This condition is satisfied here]. else (If the condition of step 1 is not satisfied then only go to else part ) 2.Compare time t (Message time stamp) with TP1 (Current Time running at P1). Time running at P1 before receiving the message is (0,0,0). If t < TP1 then receive the message else (if this step is false) 3.Buffer the Message [t >= TP1] For Figure 1 only Step1 is fulfilled that is why M1 is received at point y at P1. [Assume M3 has not been received at x]

5
What will happen at P1 when Message is delivered at point y STEP A Merge VP1 & VM. Update VP1 by values of VM. 1.If for any process say P (not equal to P1) there exits an entry in VM but does not have any entry in VP1 then that entry has to be inserted in VP1. 2.If for any process say P (not equal to P1) there exists an entry in both VM and VP1 then you have to update the value for that process in VP1 by setting the time =max(a,b) where a is time in VM and b is time in VP1 In our case after receiving Message M1, both VP1 & VM are ( __, __) So there Merge operation will be same i.e. ( __, __) SO VP1 after Merge will be ( __, __ ) i.e. empty STEP B. Update P1’s logical clock so time at P1 will be (1,1,0) STEP C. Check for Buffered Messages at P1. There is no buffered Messages at P1.

6
Now Complete State of System after Receiving M1 by P1 is shown as follows ProcessVectorTime P1 VP1 ( __, __) [Empty] (1,1,0) at y P2 VP2 : {P1,(0,1,0), __ }. Note that VP2 updated after sending Message M1 (0,1,0) P3 VP3 ( __, __) [Empty] (0,0,0)

7
Now Consider the case when M2 is sent from P2 to P3 Send Step of M2 from P2 to P3 1.P2 Sends Message M2 to P3. So P2 sends the Message M2 with VM as { P1,(0,1,0), __ } and time stamped as (0,2,0). So the format of sent message looks like { (P1,(0,1,0), __ ), (0,2,0) } 2.After Sending Message it updates its own vector VP1. Here P2’s vector entry corresponding to P3 is empty. So now VP2 becomes { (P1,(0,1,0)), (P3,(0,2,0) }. Note that this will be VP2 after sending message M2. So the state of the system looks like as follows ProcessVectorTime P1VP1 ( __, __) [Empty](1,1,0) at y P2VP2 : {P1,(0,1,0), P3,(0,2,0)} After sending M2(0,2,0) P3VP3 ( __, __) [Empty] P3 has not received M2 yet(0,0,0)

8
Receiving of M2 by P3 at Point a of Figure Receiving of M2 by P3[Note here what P3 has received from P2. Message of form [{ P1,(0,1,0), __ }, (0,2,0)] i.e. [VM,t] Check 1.If the Accompanying VM contains any entry corresponding to P3, If not receive the message. [This condition is satisfied here. VM’s entry for P3 is empty]. else (If the condition of step 1 is not satisfied then only go to else part ) 2.Compare time t which is in the message with time at P1. Time running at P1 before receiving the message is (0,0,0). If t <= tP1 then receive the message else (if this step is false) 3.Buffer the Message For Figure 1 only Step1 is fulfilled that is why M2 is received at point a at P3.

9
What will happen at P3 when Message M2 is delivered at point a STEP A Merge VP3 & VM. Update VP3 by values of VM. 1.If for any process say P (not equal to P3) there exists an entry in VM but does not have any entry in VP3 then that entry has to be inserted in VP1. 2.If for any process say P (not equal to P1) there exists an entry in both VM and VP1 then you have to update the value for that process in VP1 by setting the time =max(a,b) where a is time in VM and b is time in VP1 In This case VM is [ {P1,(0,1,0)}, __ ] andVP3 is ( __, __) [Note VM contains entry for P1. Step1 condition ] SO VP3 after Merge will be [{P1,(0,1,0)}, __ ] STEP B. Update P3’s logical clock so time at P3 will be (0,2,1) STEP C. Check for Buffered Messages at P3. There is no buffered Messages at P3.

10
Now Complete State of System after Receiving M2 by P3 at point a is shown as follows ProcessVectorTime P1 VP1 ( __, __) [Empty] (1,1,0) at y P2 VP2 : [ {P1,(0,1,0)},{P2,(0,2,0)}] Note that VP2 updated after sending Message M2 (0,2,0) P3 VP3 ({P1,(0,1,0)}, __) (0,2,1) at a

11
Now Consider the case when M3 is sent from P3 to P1 at point b of Figure 1 Send Step of M3 from P3 to P1 1.P3 Sends Message M3 to P1. So P3 sends the Message M3 with VM as { P1,(0,1,0), __ } and time stamped as (0,2,2). So the format of sent message looks like { (P1,(0,1,0), __ ), (0,2,2) } 2.After Sending Message M3 P3 updates its own vector VP3. VP3 already contains an entry for P1 so that entry gets simply updated with latest time value. Complete state of system after sending M3 by P3 is shown below. ProcessVectorTime P1VP1 ( __, __) P1 has not received M3 so far(1,1,0) at y P2VP2 : {P1,(0,1,0), P3,(0,2,0)} After sending M2(0,2,0) P3VP3 ( P1,(0,2,2), __) P3 has sent M3(0,2,2) at b

12
Receiving of M3 by P1 at Point x of Figure1 Receiving of M3 by P1 at point x. [Note here what P1 has received from P3. Message of form [{ P1,(0,1,0), __ }, (0,2,2)] i.e. [VM,t] Check 1.If the Accompanying VM contains any entry corresponding to P1, If not receive the message. [This condition is not true for this case. Because accompanying VM contains an entry corresponding to P1]. else (If the condition of step 1 is not satisfied then only go to else part ) 2.If P1 has received Message M3 at point x then current time at that point will be (0,0,0) which is TP1. The message has come with time stamped ‘t’ as (0,2,2). Clearly t is > TP1 so the message will be buffered.

13
What will happen at P3 when Message M2 is delivered at point a STEP A Merge VP3 & VM. Update VP3 by values of VM. 1.If for any process say P (not equal to P3) there exists an entry in VM but does not have any entry in VP3 then that entry has to be inserted in VP1. 2.If for any process say P (not equal to P1) there exists an entry in both VM and VP1 then you have to update the value for that process in VP1 by setting the time =max(a,b) where a is time in VM and b is time in VP1 In This case VM is [ {P1,(0,1,0)}, __ ] andVP3 is ( __, __) [Note VM contains entry for P1. Step1 condition ] SO VP3 after Merge will be [{P1,(0,1,0)}, __ ] STEP B. Update P3’s logical clock so time at P3 will be (0,2,1) STEP C. Check for Buffered Messages at P3. There is no buffered Messages at P3.

14
Now Complete State of System after Receiving M2 by P3 at point a is shown as follows ProcessVectorTime P1 VP1 ( __, __) [Empty] (1,1,0) at y P2 VP2 : [ {P1,(0,1,0)},{P2,(0,2,0)}] Note that VP2 updated after sending Message M2 (0,2,0) P3 VP3 ({P1,(0,1,0)}, __) (0,2,1) at a

Similar presentations

OK

Python – Making Decisions Lecture 02. Control Structures A program that only has one flow is useful but limited. We can use if statements to make these.

Python – Making Decisions Lecture 02. Control Structures A program that only has one flow is useful but limited. We can use if statements to make these.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on different types of computer softwares types Ppt on non agricultural activities in nigeria Ppt on bond length of hcl Ppt on marie curie scientist Free ppt on c language Ppt on changes around us class 6 Ppt on electricity and circuits for class 6 Ppt on file system in unix what is domain Free ppt on human circulatory system Ppt on jawaharlal nehru in hindi language