Non TokenBased ME
Non TokenBased ME
Assumptions
• Messages dont get dropped, channels dont fail
• One process on each site
• While waiting for CS, a process can not make
further requests for CS
• Site either requesting CS, executing CS, or idle
(not requesting or executing). In Idle state the site
is executing outside CS.
Solution to Critical-Section Problem
1. Mutual Exclusion - If process Pi is executing in its critical section, then
no other processes can be executing in their critical sections
2. Progress - If no process is executing in its critical section and there
exist some processes that wishes to enter their critical section, then the
selection of the processes that will enter the critical section next cannot
be postponed indefinitely
3. Bounded Waiting - A bound must exist on the number of times that
other processes are allowed to enter their critical sections after a
process has made a request to enter its critical section and before that
request is granted
Assume that each process executes at a nonzero speed
No assumption concerning relative speed of the N processes
Mutual Exclusion
Requirements of Mutual Exclusion Algorithms
1. Safety Property: At any instant, only one process can
execute the critical section.
2. Liveness Property: Two or more sites should not
endlessly wait for messages which will never arrive.
A requesting site should get a chance to execute CS
in finite time.
3. Fairness: Each process gets a fair chance to execute
the CS. Fairness property generally means the CS
execution requests are executed in the order of their
arrival (time is determined by a logical clock) in the
system.
Data Structures Week 1
Performance Metrics
• Message complexity -number of messages that are required
per CS execution by a site
• Response Time - This is the time interval a request waits for its
CS execution to be over after its request messages have been
sent out .
17
Data Structures Week 1
Main Idea:
– node j need not send a REPLY to node i if j has a request with
timestamp lower than the request of i (since i cannot enter before j
anyway in this case)
27
Roucairol-Carvalho Algorithm
Improvement over Ricart-Agarwala
Main idea
– Say process I is done with CS and it has not received any requests from any
processes in the meantime then it can go ahead and get into CS again without
sending out any requests. Hence with syncronisation cost 0 it goes in again.
One case: say after process I finishes CS, it checks to find no requests for CS
from any process so it enters CS again. However actually process j had sent a
request which happened to reach process I very late after process I finished
second CS too though it was sent while first CS was executing. Hence process I
landed up doing a CS for a time stamp larger than the pending request of j which
is still not fulfilled. This might seem unfair but is not incorrect. By casual order
second CS can be ordered before or after process j. That is the second CS is
concurrent to request of Pj so ordering between them can have either before the
other And no two processes are in cs at the same time and there is no starvation.
28
Roucairol-Carvalho Algorithm
Main idea
– Once i has received a REPLY from j, it does not need to send a
REQUEST to j again to re enter CS unless it has already sent a
REPLY to j after the first CS(in response to a REQUEST from j)
29