Implementation of
Download
1 / 18

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


  • 70 Views
  • Uploaded on

Implementation of Lamp ort's Scalar clocks and Singhal-Kshemkalyani’s VC Algorithms. Kent State University Computer Science Department Saleh Alnaeli. Advanced Operating System. Spring 2010. Goals. Implementing both of the algorithms study their behavior under some different arguments

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Implementation of Lamp ort's Scalar clocks and Singhal-Kshemkalyani’s VC Algorithms' - derek-lloyd


An Image/Link below is provided (as is) to download presentation

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 - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

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


Goals
Goals

  • 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).


Lamport s scalar clocks
Lamport's Scalar clocks

  • 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 ab, 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 ab

  • scalar clocks are not strongly consistent:

    • if ab, then C(a)< C(b) but

    • C(a)< C(b), then not necessarily ab


Implementation of scalar clocks
Implementation of Scalar Clocks

  • 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


Generating the computations
Generating the computations

  • 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


Singhal kshemkalyani s algorithm for vector clock s k
Singhal-Kshemkalyani’s Algorithm for vector clock S-K

  • 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]}

  • The sent vector contains the processes’ Id’s and Clock values of changed processes.


  • S k implementation
    S-K Implementation

    • 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++.


    Events construction scheme
    Events construction scheme

    • 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


    Performance evaluation
    Performance Evaluation

    • 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


    S k simulation parameters
    S-K: Simulation Parameters

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


    Processes vs messages
    # processes vs. #messages

    • 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


    Messages vs involved processes
    #Messages vs. #involved processes

    • 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)



    Table1 and table2 s k and vc respectively
    Table1 and table2 S-K and VC respectively

    Messages Number

    # involved processes

    Used memory in units


    Verifying s k efficiency equation
    Verifying S-K efficiency equation

    • 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.


    Conclusion
    Conclusion

    • 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

      .


    Difficulties
    Difficulties

    • 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.


    References
    References

    • 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)


    ad