1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz...

18
1 Permission-based Distributed Mutual Exclusion: Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar

Transcript of 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz...

Page 1: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

1

Permission-based Distributed Mutual Exclusion: Ricart-Agrawala &Maekawa Algorithms

By: Sherenaz W. Al-Haj Baddar

Page 2: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

2

Outline

Introduction Experiments Setup Results and Analysis Further Elaboration Code snapshots: features & problems Conclusion References

Page 3: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

3

Introduction Permission-based DMX:

Accessing Critical Section (CS), via gaining permission from some(or all) other processes in the system.

Ricart-Agrawala Algorithm(RA): Process requires permission from all OTHER

processes in the system. If a process P receives a request to enter CS from

process Q, while it doesn’t want to enter CS or has a lower priority request, then P sends reply to CS Q

Else P queues Q’s request, replies after exiting CS When all OTHER processes reply to P, P enters CS

Page 4: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

4

Introduction Maekawa’s Algorithm (quorums):

Each process communicates with a limited number of adjacent nodes (quorum).

For every two quorums p and q : p∩q <>ФWhen P wants to enter CS it gains permission

from all q membersQuorum member Q, has one permission to

give, if given, then queue P’s request.After exiting CS, P sends release to all q

members, allowing q members to send reply to queued requests

Page 5: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

5

Experiments Setup Number of nodes:4-40 (before msgs get swallowed)

Duration: 30000 TOSSIM Clock Ticks (neither short nor long)(PART1) 50000-130000 TOSSIM Clock Ticks (neither short nor long)(PART2)

Metrics considered: Synchronization delay Message complexity Responsiveness: the amount of time that elapses since P requests CS until

it enters it for the first time. record system time (getLow32(), SimpleTimeInterface), after initiating request to

CS record system time just after entering CS accumulate the difference in some global variable.

Assuming LL (msgs being swallowed) Delay Timers were used to control the frequency and duration of

accessing CS (basically, every 1024 Tick).

Page 6: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

6

Experiments Setup RA algorithm:

Fully connected topology: CS requests broadcasted, replies unicasted

MK algorithm: Assumes a connected topology(as long as quorum members can

access each other) In TOSSIM: the underlying Topology is Fully Connected Quorum formation: Using Billiard Quorums… Number of nodes Quorum size

4,6,8 310,12 524,28 734,40 9

With elaboration on the relationship between quorum size and msg complexity & responsiveness)

Page 7: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

7

Billiard QuorumsAgrawal, Egecioglu, and Abbadi Assumes system nodes arranged into a 2-D grid. Meakawa’s quorum for N1/2XN1/2 grids are of size 2N1/2. Billiard Quorums are of size 21/2 *N1/2. Assumes number of nodes N=(q2-1)/2 and assumes that q is odd

(maintain symmetry). Let P be located in cell(i,j), and denoted by R(i,j) then its quorum

members can be found along the lines: R(i-1,j+j) = R(i,j)-(q-1)/2 R(i+1,j+1)= R(i,j)+(q+1)/2 R(i+1,j-1)= R(i,j)+(q-1)/2 R(i-1,j-1)= R(i,j)-(q+1)/2

Page 8: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

8

Results & AnalysisSynchronization Delay

Sunchronization Delay

0

0.5

1

1.5

2

2.5

4 6 8 10 12 16 20 24 28 34 40

Number of Nodes

Nu

mb

er

of

Messag

es U

po

n

Exit MK

RA

Page 9: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

9

Results & AnalysisMessage Complexity

Messages Per CS Entry

0

10

20

30

40

50

60

70

80

4 6 8 10 12 16 20 24 28 34 40

Number of Nodes

Nu

mb

er

of

messag

es

MK

RA

•Message complexity: RA has significantly higher message complexity when number of nodes >= 6. As Expected.

•Unified quorum size reduces sensitivity to System size.

Page 10: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

10

Results & AnalysisResponsiveness

According to responsiveness definition:

More nodes to contact More delay

Expectation: RA has SLOWER responsiveness than MK….

Page 11: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

11

Results & AnalysisResponsiveness

Responsiveness

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

4 6 8 10 12 16 20 24 28 34 40

Number of Nodes

Clo

ck T

icks

MK

RA

Two major points:

- MK has SLOWER responsiveness!!! WHAT WENT WRONG???

-RA‘s responsiveness less sensitive towards system size increase (quorum size effect).

Page 12: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

12

Results & AnalysisResponsiveness

The unexpected behavior is due to the nature of the implementation environment.

To communicate with everybody else, in RA, mote sends one sndMsg.send to the broadcast address, if returns true, then responsiveness timing starts.

To communicate with your quorum Q, you are supposed to send a unicast message to each quorum member, after all contacted successfully (request initiated successfully), then responsiveness timing starts.

To overcome this anomaly: Start measuring responsiveness after contacting first member

(semantics not exact). Broadcast requests, ignore request when necessary(back to RA!! Use a platform that supports multicast ?!

Page 13: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

13

Results & Analysisquorum size and message complexity Larger quorum size higher message complexity

Quorum size & Msg Complexity

0

20

40

60

80

100

120

140

t=50000 t=70000 t=110000 t=130000

time(clock ticks)

num

ber

of m

essa

ges

3

4

5

Page 14: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

14

Results & Analysisquorum size and responsiveness

Larger quorum size slower responsiveness

Quorum size & responsiveness

0

5000

10000

15000

20000

25000

30000

35000

40000

t=50000 t=70000 t=110000 t=130000

time(clock ticks)

res

po

ns

ive

ne

ss

3

4

5

Page 15: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

15

Further Elaboration

Overcome message loss due to high contention to be able to measure pure HL.

Implement the DL free version of MK (extra msg loss &overhead).

Investigate the issue of assigning quorum members such that DL possibility is reduced (i.e. NO DL implementation).

Extend these two algorithms for Multi-hop networks?? Extend these two algorithms for generalized DMX

scenarios??

Page 16: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

16

Conclusion

Permission based DMX induce relatively high message complexity. Permission based DMX induce relatively low synchronization

overhead. Permission based DMX exhibit less sensitivity to system load. RA has higher message complexity and lower synchronization delay

than MK RA is supposed to have slower responsiveness than MK. However,

the implementation platform may enforce different sort of relations. Larger quorum size slower responsiveness and higher msg

complexity.

Page 17: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

17

Code SnapShot

Page 18: 1 Permission-based Distributed Mutual Exclusion : Ricart-Agrawala & Maekawa Algorithms By: Sherenaz W. Al-Haj Baddar.

18

References

D. Agrawal, O. Egecioglu, A. El Abbadi, "Billiard Quorums on the Grid," Information Processsing Letter 64 (1997) 9-16.

TOSSIM User Manual, http://deneb.cs.kent.edu/~mikhail/classes/aos.f06/aos_tos_tutorial/tos_tutorial.html,2006.

D. Gay, Lives, P., and Behren R.,The nesC Language: A Holistic Approach to Networked Embedded Systems, http://nescc.sourceforge.net.

D. Gay, Lives, P., and Behren, R., nesC 1.1 Language Reference Manual David Gay, Philip Levis, David Culler, Eric Brewer, May 2003.

TinyOs mailing Archive, http://deneb.cs.kent.edu/~mikhail/classes/aos.f06/aos_tos_tutorial/tos_tutorial.html