1 / 40

Mutual Exclusion in Distributed Systems

Mutual Exclusion in Distributed Systems. decentralized algorithmsnon-token based algorithmsLamport's algorithmRicart-Agrawala's algorithmMaekawa's algorithmtoken based algorithmstoken-ring algorithmbroadcast algorithmtree-based algorithmself-stabilizing algorithm. Lamport's Algorithm. Req

sadie
Download Presentation

Mutual Exclusion in Distributed Systems

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Mutual Exclusion in Distributed Systems Single Processor Systems use semaphore, monitor, etc. Distributed Systems centralized algorithm central server coordinate the ordering for entering CS overload the central site introduce a single point of failure in the system

    2. Mutual Exclusion in Distributed Systems decentralized algorithms non-token based algorithms Lamport's algorithm Ricart-Agrawala's algorithm Maekawa's algorithm token based algorithms token-ring algorithm broadcast algorithm tree-based algorithm self-stabilizing algorithm

    3. Lamport's Algorithm Request the CS: 1. Pi broadcasts request (ti, i) to all processors and puts the request in its local queue (in the order of timestamps t of the requests) 2. Pj upon receiving the request (ti, i), puts the request in its local queue (in the order of timestamps t of the requests) and sends reply (ti, j) to Pi Enter the CS: 1. if Pi has received reply messages from all sites with timestamps larger than ti and its request is at the top of the queue, then it enters the CS Release the CS: 1. Pi, upon exiting CS, removes its request from the queue and sends release (ti, i) to all processors 2. Pj, upon receiving the message, removes the request from the top of the queue

    4. Lamport's Algorithm -- Properties this algorithm requires a total ordering of events all sites to be alive requires 3(N?1) messages per request response time in a very low load 2T T: per message communication latency assume there is no one in CS send N?1 request messages sent in parallel (T) send N?1 response messages sent in parallel (T) so, requester enters CS after 2T time

    5. Ricart-Agrawala's Algorithm Request the CS: 1. Pi broadcasts request (ti, i) to all processors 2. Pj, upon receiving the request a) sends reply (j) to Pi if Pj is neither requesting nor executing in the CS b) sends reply (j) to Pi if Pj is requesting the CS but the timestamp for Pj’s request is larger than ti c) defers the request otherwise Enter the CS: 1. if Pi has received reply messages from all sites, then it enters the CS Release the CS: 1. Pi upon exiting CS, sends reply (j) to all the deferred requests

    6. Ricart-Agrawala's Algorithm this algorithm requires a total ordering of events require all sites to be alive requires 2(N?1) messages per request response time in a very low load 2T send N?1 request messages in parallel (T) send N?1 response messages in parallel (T)

    7. Maekawa's Algorithm Request set each node has a request set when the node wants to enter the critical section, it sends its request to all nodes in its request set the request set of each node does not include all nodes in the system the intersection of any two request sets is non-empty Example consider three nodes, X, Y, and Z X’s request set include nodes X and Y Y’s request set include nodes Y and Z Z’s request set include nodes Z and X

    8. Maekawa's Algorithm Request the CS: 1. Pi multicasts request (ti, i) to its request set, including itself 2. Pj upon receiving the request a) if it is not currently locked, then locks itself and sends reply (j) to Pi b) otherwise, puts the request in a queue (in the order of the timestamp) Enter the CS: 1. if Pi has received reply messages from all sites in its request set, then it enters the CS Release the CS: 1. Pi upon exiting CS, sends release (ti) to all processors in its request set 2. Pj upon receiving the message a) if the waiting queue is not empty then it removes the entry in the queue and sends reply (j) to that node b) otherwise, unlocks itself

    9. Maekawa's Algorithm -- Properties requires a total ordering of events requires 3?N messages per request response time in a very low load 2T send K?1 request messages sent in parallel (T) send K?1 response messages sent in parallel (T) has the potential deadlock problem

More Related