naive vector clocks and singhal & kshemkalyani's vector clocks presented by: :: abdulkareem...

13
Naive Vector Clocks and Naive Vector Clocks and Singhal & Kshemkalyani's Singhal & Kshemkalyani's Vector Clocks Vector Clocks Presented by: Presented by: :: :: Abdulkareem Alali Abdulkareem Alali :: ::

Upload: byron-willis

Post on 16-Dec-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Naive Vector Clocks and Naive Vector Clocks and Singhal & Kshemkalyani's Singhal & Kshemkalyani's

Vector ClocksVector Clocks

Presented by:Presented by:

:::: Abdulkareem Alali Abdulkareem Alali ::::

Page 2: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Briefly :Naive Vector Clocks vs. SK’s

Vector ClocksNaïve Vector Clocks ::: Vector clock of a system of N processes is an

array of N logical clocks, 1 per process, a local copy of which is kept in each process with the following rules for clock updates:

:: Initially all clocks are 0. For an internal event, increments its own logical clock in the vector by 1. Before send a message, it increments its own logical clock in the vector by 1. Each time a process receives a message, it increments its own logical clock in the vector by 1 and updates each element in its vector by taking the maximum of the value in its own vector clock and the value in the vector in the received message (for every element).

Page 3: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Briefly :Naive Vector Clocks vs. SK’s

Vector Clocks [cont.]SK’s Vector Clocks

:: Based on the observation that between successive message sends to the same process, only a few entries of the vector clock at the sender process are likely to change.

:: On average the size of the time stamp on a message will be less than N.

Page 4: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Approach:: All processes start by calling the task

Processing().

:: Processing() with some probability depending on the MAX_NODES will update the logical clock by 1, else will send a message randomly to other process.

:: In case the message received at any process, updates hold and Processing() will be called.

:: For failed message sending, A delay event will be invoked for IMER_ONE_SHOT 1024 and then Processing() will be called.

Page 5: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Code Architecturetask Processing(){

if ( choice > P(MAX_NODES))/*P is a probability function with a high chance return a number larger than choice*/

{clock[LOCAL_ADDRESS]++;}else{target = Random(MAX_NODES);

/*Random is a function the returns a random number between 0 - MAX_NODES*/ sendMessageTo(target);

}event receiveMessage( mptr ){

clock[LOCAL_ADDRESS]++;MessagesCounter++;for ( i = 0; i < MAX_NODES; i++){if ( mptr->clock[i] > 0 &&

mptr->clock[i] != clock[i] )ChangesCounter++;}

}

Page 6: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Average Naive vs SK

0

500

1000

1500

2000

2500

3000

3500

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Nodes

Co

st(B

ytes

)

NVC

SKCV

Page 7: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Standard Deviation Naive vs SK

0

1000

2000

3000

4000

5000

6000

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Nodes

Co

st(B

ytes

)

NVC

SKVC

Page 8: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

SK-VC / NVC Average

0

0.1

0.2

0.3

0.4

0.5

0.6

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Nodes

SK

-VC

/ N

VC

Ave

rag

e

SK-VC / NVC Avg

Page 9: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

SK-VC / NVC Standard Deviation

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Nodes

SK

-VC

/ N

VC

Sta

nd

ard

Dev

iati

on

SK-VC / NVC SD

Page 10: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Conclusion

:: As mentioned before we conclude that SK vector clocks algorithm - as in the targeted approach – would maintain lower cost than the Naive vector clock implementation and that would appear clearly in huge systems.

Page 11: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Future Work

:: In general, with a much better approach we could have more precise results that really simulate the real wireless systems because Randomness is not what the real world behaves.

:: In special, for my approach, Function P could be studied in more depth to have a choice more balanced every time. The one I’m using right now is too simple.

Page 12: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

Problems

:: Time shortage (my problem).:: Very hard to trace the code.:: Memory limitations.:: I faced a major problem with

Random generating function. Till at the end I coded something on my own.

Page 13: Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::

THE END