DSCC Unit 3 PDF
DSCC Unit 3 PDF
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.
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:
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.
(N – 1) request messages
(N – 1) reply messages
(N – 1) release messages
RICART–AGRAWALA ALGORITHM
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.
(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
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
Performance:
Synchronization delay is equal to twice the message propagation delay time
It requires 3√n messages per critical section execution.
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:
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