0% found this document useful (0 votes)
39 views6 pages

DSCC Unit 3 PDF

The document discusses various distributed mutual exclusion algorithms, including Lamport's, Ricart-Agrawala, Maekawa's, and Suzuki-Kasami's broadcast algorithm. It outlines the requirements for mutual exclusion, such as no deadlock, no starvation, fairness, and fault tolerance, as well as performance metrics like message complexity and response time. Each algorithm is explained in detail, highlighting their message types, execution processes, and message complexities.

Uploaded by

23102208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views6 pages

DSCC Unit 3 PDF

The document discusses various distributed mutual exclusion algorithms, including Lamport's, Ricart-Agrawala, Maekawa's, and Suzuki-Kasami's broadcast algorithm. It outlines the requirements for mutual exclusion, such as no deadlock, no starvation, fairness, and fault tolerance, as well as performance metrics like message complexity and response time. Each algorithm is explained in detail, highlighting their message types, execution processes, and message complexities.

Uploaded by

23102208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Unit III

DISTRIBUTED MUTUAL EXCLUSION ALGORITHMS

Introduction-Lamport’s algorithm-Ricart–Agrawala algorithm-Quorum-based mutual exclusion


algorithms-Maekawa’s algorithm-Suzuki–Kasami’s broadcast algorithm.

Mutual exclusion:

Mutual exclusion in a distributed system states that only one process is allowed to execute the critical section
(CS) at any given time.

Requirements of mutual exclusion algorithms:

 No Deadlock:

Two or more site should not endlessly wait for any message that will never arrive.

 No Starvation:

Every site who wants to execute critical section should get an opportunity to execute it in finite time.

 Fairness:

Each site should get a fair chance to execute critical section.

 Fault Tolerance:

In case of failure, it should be able to recognize it by itself in order to continue functioning without any
disruption.

.
Performance metrics:

 Message complexity: The total number of messages exchanged in the system for one critical section (CS)
execution.

 Synchronization delay: The time between one site leaving the CS and another site entering the CS.

 Response time: Response time is the time interval from when a process sends a request to enter the
critical section (CS) until it finishes its execution inside the CS.

 System throughput: The rate at which the system completes CS executions. If SD is the
synchronization delay and E is the average critical section execution time.
Explain different mutual exclusion algorithms in detail.

Lamport’s Algorithm
 Lamport Distributed Mutual Exclusion Algorithm is a permission based algorithm proposed by
Lamport.
 Three type of messages ( REQUEST, REPLY and RELEASE) are used.
 A site send a REQUEST message to all other site to get their permission to enter critical section.
 A site send a REPLY message to requesting site to give its permission to enter the critical section.
 A site send a RELEASE message to all other site upon exiting the critical section.
 Every site keeps a queue to store critical section requests ordered by their timestamps.
 Timestamp is used to determine priority of critical section requests.

Algorithm
 To enter Critical section:
o When a site Si wants to enter the critical section, it sends a request message Request(tsi, i) to all
other sites and places the request on request_queuei. Here, Tsi denotes the timestamp of Site Si
o When a site Sj receives the request message REQUEST(tsi, i) from site Si, it returns a time stamped
REPLY message to site Si and places the request of site Si on request_queuej
 To execute the critical section:
o Site Si must have received messages from all other sites with timestamps larger than its own
request's timestamp.
 To release the critical section:
o When a site Si exits the critical section, it removes its own request from the top of its request queue
and sends a time stamped RELEASE message to all other sites
o When a site Sj receives the time stamped RELEASE message from site Si, it removes the request of
Si from its request queue

Example:
Message Complexity: Lamport’s Algorithm requires invocation of 3(N – 1) messages per critical section execution.

These 3(N – 1) messages involves

 (N – 1) request messages
 (N – 1) reply messages
 (N – 1) release messages

Explain Ricart–Agrawala Algorithm in detail.

RICART–AGRAWALA ALGORITHM

 Ricart–Agrawala algorithm is an algorithm to for mutual exclusion in a distributed system


proposed by Ricart and Agrawala.
 It follows permission based approach to ensure mutual exclusion.
 Two type of messages ( REQUEST and REPLY) are used.
 A site send a REQUEST message to all other site to get their permission to enter critical section.
 A site send a REPLY message to other site to give its permission to enter the critical section.
 Timestamp is used to determine priority of critical section requests.

Algorithm:
1. To enter Critical section:
o When a site Si wants to enter the critical section, it send a time stamped REQUEST message to all
other sites.
o When a site Sj receives a REQUEST message from site Si, It sends a REPLY message to site Si if
and only if
o Site Sj is neither requesting nor currently executing the critical section.
o In case Site Sj is requesting, the timestamp of Site S i‘s request is smaller than its own
request.
2. To execute the critical section:
o Site Si enters the critical section if it has received the REPLY message from all other sites.
3. To release the critical section:
o Upon exiting site Si sends REPLY message to all the deferred requests.

Message Complexity: Ricart–Agrawala algorithm requires invocation of 2(N – 1) messages per critical section
execution.

These 2(N – 1) messages involves

 (N – 1) request messages
 (N – 1) reply messages
Explain Maekawa‘s Algorithm in detail.

Maekawa‘s Algorithm

 Maekawa’s Algorithm is quorum based approach to ensure mutual exclusion in distributed systems.
 Three type of messages ( REQUEST, REPLY and RELEASE) are used.
 A site send a REQUEST message to all other site to get their permission to enter critical section.
 A site send a REPLY message to requesting site to give its permission to enter the critical section.
 A site send a RELEASE message to all other site in its request set when exiting the critical section.

Algorithm

To enter Critical section:


 When a site Si wants to enter the critical section, it sends a request message REQUEST(i) to all other sites
in the request set Ri.
 When a site Sj receives the request message REQUEST(i) from site Si, it returns a REPLY message to
site Si if it has not sent a REPLY message to any other site. Otherwise, it queues up the request.

To execute the critical section:


 A site Si can enter the critical section if it has received the REPLY message from all the site in request
set Ri
To release the critical section:
 When a site Si exits the critical section, it sends RELEASE(i) message to all other sites in request set Ri
 When a site Sj receives the RELEASE(i) message from site Si, it send REPLY message to the next site
waiting in the queue and deletes that entry from the queue

Message Complexity: Maekawa’s Algorithm requires invocation of 3√N messages per critical section execution as
the size of a request set is √N. These 3√N messages involves.
 √N request messages
 √N reply messages
 √N release messages

Drawbacks of Maekawa’s Algorithm:


 This algorithm is deadlock prone because a site is exclusively locked by other sites and requests are not
prioritized by their timestamp.

Performance:
 Synchronization delay is equal to twice the message propagation delay time
 It requires 3√n messages per critical section execution.

Advantages of Maekawa’s Algorithm:

 Low Message Complexity


 Scalability
 Fairness
Explain Suzuki–Kasami’s broadcast algorithm in detail.

Suzuki–Kasami’s broadcast algorithm:

 Suzuki–Kasami algorithm is a token-based algorithm for achieving mutual exclusion in distributed


systems.
 This is modification of Ricart–Agrawala algorithm which uses REQUEST and REPLY
messages to ensure mutual exclusion.
 In token-based algorithms, A site is allowed to enter its critical section if it possesses the
unique token

Data structure and Notations:

 RN[1…N]: Tracks the largest sequence number of request messages received from other sites.
 LN[1…N]: This array is used by the token. Stores the sequence number of the most recent token
used by each site.
 Queue Q: This queue keeps track of which sites are waiting for the token.

Algorithm:

1. To enter Critical section:


o When a site Si wants to enter the critical section and it does not have the token then it increments its
sequence number RNi[i] and sends a request message REQUEST(i, sn) to all other sites in order to
request the token. Here sn is update value of RNi[i]
o When a site Sj receives the request message REQUEST(i, sn) from site Si,
it sets RNj[i] to maximum of RNj[i] and sn i.e RNj[i] = max(RNj[i], sn).
o After updating RNj[i], Site Sj sends the token to site Si if it has token.
2. To execute the critical section:
o Site Si executes the critical section if it has acquired the token.
3. To release the critical section:
After finishing the execution Site S i exits the critical section and does following:
o sets LN[i] = RNi[i] to indicate that its critical section request RNi[i] has been executed
o After above updation, if the Queue Q is non-empty, it pops a site ID from the Q and sends the
token to site indicated by popped ID.
o If the queue Q is empty, it keeps the token

Message Complexity:

The algorithm requires 0 message invocation if the site already holds the idle token at the time of critical
section request or maximum of N message per critical section execution. This N messages involves

a. (N – 1) request messages
b. 1 reply message

You might also like