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

## Presentation on theme: "Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::"— Presentation transcript:

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

Briefly : Naive Vector Clocks vs. SK’s Vector Clocks Naï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).

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.

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.

Code Architecture task 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++; }

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.

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.

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.

THE END

Download ppt "Naive Vector Clocks and Singhal & Kshemkalyani's Vector Clocks Presented by: :: Abdulkareem Alali ::"

Similar presentations