- 41 Views
- Uploaded on
- Presentation posted in: General

Implementation of Lamp ort's Scalar clocks and Singhal-Kshemkalyani’s VC Algorithms

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Implementation of

Lamport's Scalar clocks and Singhal-Kshemkalyani’s VC Algorithms

Kent State University

Computer Science Department

Saleh Alnaeli

Advanced Operating System. Spring 2010

- Implementing both of the algorithms
- study their behavior under some different arguments
- Processes Number
- Messages Number
- Involved processes Number in the computation

Note: This presentation assumes that you have a back ground about Logical Clocks and some of its related algorithms (Scalar, Vector, S-K).

- was proposed by Lamport 1978
- to totally order events in distributed system
- each process Pi has a logical clock Ci (represented as integer value)
- consistency condition
- consistency: if ab, then C(a) C(b)
- if event a happens before event b, then the clock value (timestamp) of a should be less than the clock value of b

- strong consistency: consistency and
- if C(a)C(b) then ab

- consistency: if ab, then C(a) C(b)
- scalar clocks are not strongly consistent:
- if ab, then C(a)< C(b) but
- C(a)< C(b), then not necessarily ab

- Rule1: before executing event update Ci so, Ci:= Ci+ d (d>0)
- Rule2:attach timestamp of the send event to the transmitted message when received, timestamp of receive event is computed as follows: Ci:= max(Ci , Cmsg) and then execute R1
- It is implemented in C++ and was verified in different ways:
- Checking its consistency using a function compares the new value of previous one locally and with the sender in receive event
- Results were compared with vector clock application

- Computations were entered from input text file
- Generated manually and using a computation generator developed in C++ randomly (random sender and receiver)
- Each event is constructed according the following scheme:
EventType,SenderID,ReceiverID such that:

EventType is 1 for internal event, 2 for send event and 3 for receive event.

- Example:3,7,8 means an event to receive a SMS was sent by Pcocess 7 to 8 // Also
- order of the events can be changed in the InputFile just make sure the receive event is preceeded by send event
- SMS not found or lost for receive without send event.
- Sending to process it self is an internal event. Example 2,5,5

- Considered as an efficient implementation of vector clocks.
- instead of sending the whole vector only need to send elements that changed. And same update rules are used for the recipient process.
- maintain two vectors :
- LS[1..n] – “last sent”
- LU[1..n]
- needs to send with the message only the elements that meet the condition: {(x,vti[x])| LSi[j] < LUi[x]}

- It is implemented in C++ and was verified in different ways:
- Results were compared with others generated by a combined Scalar and vector clock application.
- Known examples and random computations were used.

- Computations were entered from input text file
- Computations were generated using a computation generator developed in C++.

- similar to scalar events format with extra field:
- EventType,SenderID,ReceiverID,EventId such that:
EventType is 1 for internal event, 2 for send event and 3 for receive event.

EventId is number of the event when the message has been sent

- Example:3,7,8,4 means an event to receive a SMS was sent by Process 7 to 8 and the event was the fourth send event
- order of the events can be changed in the InputFile just make sure the receive event is preceeded by send event
- SMS not found or lost for receive without send event.
- Sending to process it self is an internal event. Example 2,5,5,4

- Lamport’s Scalar Clock algorithm:
- There were not enough area to study (trivial)

- S-K algorithms
- Performance metrics evaluated include
- Stamps Memory size used in units (1 unit=32 bytes)

- Conditions of varying
- Processes Number, messages Number, and number of the involved processes in the computation.

- It’s expected that SK in the worst case will perform as VC

- Performance metrics evaluated include

Expectations: In the worst case of S-K will be Vector clock’s work.

- events by sequence1 with 2500 messages and 50 lost
- figure1 shows that S-K out performance regular VC even with changing the No of processes and involved processes as well

Not Sufficient and not satisfied

- Events were generated randomly with sequence 2 (randomly picking sender and receiver)
- After sending, message is directly received to got more updates in locals V.
- Constant # of processes 50
- Changing # of involved processes (10-50)

Messages Number

# involved processes

Used memory in units

- S-K original paper states that their technique can be beneficial if n<N.b/(log2N+b)
Such that: n=avr of entries in Ti, b=bits in a sequence number, log2N=bits needed to code N process ids.

- It doesn’t work with my simulation !!!
- I have calculated n value in (2500,40 and 110548,30 ) and I compared it with their equation but did not work!!!

- Mine is :
- When of involved processes gets close to 70% and #of messages gets close to 20N, then S-K becomes inefficient.

- The sequence of the events plays big role in determining the efficiency of S-K
- Number of the involved processes in the computation can affect S-K performance
- For low # of messages, S-K seems fine.
- When # of involved processes is about 70% and #of messages close to 20N then S-K becomes a weak.
- Efficiency equation is not applicable in my experiment
.

- The most difficult issue was generating a computation that can be used for adequate results.
- It’s Difficult to predict the order of receiving the messages which make it difficult to generate a computation close to reality.

- Original S-K paper
- Logical clock, Adv OS course slides.
- Prof. Mikhail Nesterenko (Acknowledge)
- http://deneb.cs.kent.edu/~mikhail/classes/aos.s10/

- S-k implementation-Manas Hardas. KSU. (Acknowledge)