SlideShare a Scribd company logo
1 of 39
Download to read offline
Mutual Exclusion
 Ensuring mutual exclusion means that the shared resource(critical region) is
exclusively available to one process at any given time.
 Requirements of Mutual ExclusionAlgorithms :-
 1. Safety Property :At most one process may execute in CR at a time
 Liveness Property: a process requesting entry to CR is eventually granted it.There
should not be deadlock and starvation.
 Fairness : Each process should get a fair chance to execute the CR
 Performance Metrics:-
 Synchronization delay: - time interval between CR exit and new entry by any process
 System throughput :- Rate at which requests for the CR get executed
 Message complexity:- Number of messages that are required per CR execution by
process
 Response time:-Time interval from a request send to its CR execution completed.
Classification of Mutual Exclusion Algorithms
 Centralized mutual exclusion algorithms- use coordinator to guarantee safety,
liveness and fairness properties
 Distributed mutual exclusion algorithms- do not use centralized arbitrator. Further
classified as
 Non token based- exchange messages amongst the processes to determine which
process gets to enter the CR.The request for grant of permission to enter may be to all
or a subset(quorum) of processes.When the conditions as specified by the algorithm are
satisfied , only one process enters the CR at a given time is guaranteed.
 Token Based – a unique token is shared among the process.A process is allowed to
enter its CR if it possess the token and it continues to hold the token until the
execution of the CR is over.
Distributed Mutual Exclusion
 Distributed Mutual Exclusion algorithm does not use coordinator but uses logical
clock for event ordering.The processes coordinate amongst themselves to
guarantee mutual exclusion.
 1. Non-Token Based
 Lamport’s Distribution MutualAlgo
 Ricart-Agrawala Algo
 Maekawa’sAlgo
 2.Token Based
o Suzuki-Kasami’s Broadcast Algo
o Singhal’s Heuristic Algo
Centralized Algorithm
 Process send REQUEST to the centralized ,elected coordinator to enter CR
 Coordinator acts as an arbitrator and serialization of the requests is guaranteed by it
 If no other process is currently executing the CR, variable Grant=F(alse) & Request
Queue, Req_Q=E(mpty)
 Coordinator grants permission to requesting process by sending REPLY message and
granting the permission (variable GRANT=T(rue)).This Process is not allowed to enter
the CR.
 If CR is being executed by another process when the request for permission arrives , this
could be queued (blocking the process) by coordinator or it could reply back to the
requesting process with‘permission denied’ message so that process could send the
request at some other time.
 When process executing CR exits , it sends RELEASE message to coordinator
Lamport’s Distributed Mutual Exclusion Algo
 Uses Lamport’s timestamp logical clock synchronization mechanism to establish priority
amongst the processes/nodes present in the distributed system.
 The serialization of the order of processes entering CR(Critical Region) is maintained by
FIFO request queue, RQ of each process.
 A process Pi Broadcast locally timestamped REQUEST message along with its own
identifier.
 On receiving the REQUEST, every process inserts this request in its Rqi, which contains
all incoming requests.
 The requests get inserted at the correct place(based on increasing value of the
timestamp).
 Pi also inserts this value in its own Rqi.
 The queue Rqi at any process Pi maintains the order of processes entering the CR.
Performance Parameters
 Has message overhead of total 3(N-1): (N-1) Request messages, (N-1) Reply
messages, (N-1) Release messages per CR invocation
 Can be optimized by reducing the number of RELEASE messages sent.
Recart-Agrawala Algorithm
 Based on distributed agreement using timestamps
 Uses Lamport’s logical clock to synchronize and assign timestamps to its messages
 Is similar to Lamport’s Distributed Mutual Exclusion except difference in sending of REPLY messages
 Pi sends its REQUEST message with its timestamp and identifier indicating its wish to enter CR
 If process receiving request doen not want to enter the CR (nor it is currently executing in the CR), it sends
a REPLY message back to the process requesting , granting it, its permission to enter.
 If REPLY comes back from all processes , only then the requesting process enters the CR.
 If the receiving process itself wants to enter the critical region , the timestamp of REQUEST message and
its own timestamp are compared to establish the priority.The requesting process’ REPLY is deferred if its
own timestamp is lower.
Performance Parameters
 The algorithm does not use explicit RELEASE messages.The dequeuing is done on
the receipt of REPLY itself.Thus total message overhead would be 2(N-1)
messages, i.e. for entering a CR, (N-1) request and exiting (N-1) replies.
 The failure of any process almost halts the algorithm as it requires all replies.
Maekawa’s Algorithm
 Is a quorum or voting based exclusion algorithm.
 Pi does not require to request all processes but only to a subset of processes i.e
quorum called Ri.
 Each process Pi in the quorum set Ri gives permission to at most one process at a
time.
Maekawa’s Quorums
 Data structures used by each process Pi,
1. The request deferred queue, Rdi (of processes REQUESTing and not REPLIED
to)
2. A variable called‘Voted’=F(ALSE) is set initially (T(RUE) when a reply is sent
indicating that it has already granted permission to process in its quorum)
Deadlock in Maekawa’s Algorithm
 Process P1 and Process P3 want to enter CR. Both these processes send their respective
REQUEST messages to their quorum set R1and R3 waiting for REPLY from all the set
members.
 Let’s say the REQUEST message of P1 reaches P4 earlier and as there is no other
REQUEST message prior to this message at P4(RD4=empty), theVoted4 variable is False.
So REPLY is sent back to P1,nowVoted4 in P4 is set toTRUE.
 Meanwhile the REQUEST message of P3 also reaches P2 and in the same way, P2 sends
REPLY to P3 and sets its ownVoted2 variable toTRUE. Now waits for a REPLY from P2,
which cannot be sent (VOTED2 isTRUE)
 Thus the request of P1 is deferred and the deferred queue of P2 now has an entry of
P1(RD2[1]=P1). Similarly the REPLY can’t be sent to process P3 by P4 and deferred
queue of process P3 is RD4[1]=P3. so now P1 is waiting for P2’s REPLY,P2 for P3’s
RELEASE,P3 for P4’s REPLY and P4 for P1’s RELEASE,thus resulting in deadlock.
Performance Parameters
 An execution of CR requires √N REQUEST, √N REPLY and √N RELEASE
messages thus requiring total 3 √N messages per CR execution.
 Synchronization delay is 2T
 M=K= √N works best.
Suzuki-Kasami Broadcast Algo
 Token Base Algorithm
 Process holding theTOKEN can enter CR.
 Basic idea is to contact every process in completely connected network of P processes,
and gather the grant REPLYs from all to establish mutual exclusion.
 Process not having token , wants to enter the CR , it has to broadcast its request for
granting permission to all processes using primitive REQUEST for token.
 REQUEST(i,n)  i is the process identifier and n sequence number of the request it is
sending. E.g. REQUEST(3,4)  process 3 requesting and this is its fourth request.
Data structures used
 By process Pi
 Request array Ri[j]; j=1 to N processes
e.g. R2[3]=5 Process 2 knows that process 3 has sent 5 requests for entering CR
to Process 2.
When Process Pi receives REQUEST(j,n) message , it sets Ri[j]=max (Ri[j],n).
The current request is termed outdated, if the valueTi[j] is greater than n. e.g P2
receives REQUEST(3,4, n-4 indicating its 4th request. IfR2[3]=5, meaning that P2 has
already seen 5 requests earlier fromP3.As R2[3]=5>n=4, this 4th request is termed as
outdated request.
Data structures used
 By token
 Token arrayToken[i]  maintains the number of times the ith process has executed critical region. e.g
Token[1]=6 means that token was given to process 1 and its sixth REQUEST of entering CR.
Previously 5 times request was present. Once process Pi holding the token exits the CR, the value of
this array for the process holding token is updated with knowledge of process.Also if Ri[j]=token[j]+1
, then process Pi is currently requesting a token.
 Queue QT  contains queue of the processes requesting token.The process at the top os this is the
one to which token is sent next.
Singhal’s Heuristic Algorithm
 Suzuku-Kasami’s algo having N messages for just obtaining the token
 This method proposes to reduce this number by applying heuristic method , i.e. having knowledge about
each process’ current state and sending the token request accordingly.
 The process could be in any of the following 
E Executing and having the token
H Holding the token and not executing
R Requesting the token
N Neutral, none of the above
 The algorithm selects the processes which have more probability of having the token and requesting process
then sends the request to only selected ones rather than broadcasting reducing number of messages
 This is called heuristic algo as processes are heuristically selected for sending token request messages,
according to their current states.
 For example, if k is chosen to be 2, then the processes having IDs 2 and above(i>=k)
are in neutral state, process P1 (i<k) would be only process in R state.
 Thus if process P2, now wishes to enter the critical region , the REQUEST message
requires to be sent only to 1 as there is no need to send the REQUEST for the
permission grant to others as they never requested to enter in CR in the first place.
Raymond’s Tree-Based Algorithm
 Use minimal spanning tree for sending the REQUEST message to the process
which is holding token
 The spanning tree– N nodes/process is viewed as a graph; nodes/processes as
vertices and links as edges of the network
 Path from every node to every other node; the shortest path is the minimal
spanning tree
 Tree arranged as rooted tree; the process holding token has privilege to be root
 Each process maintains HOLDER variable H, which points to the root or its own
neighbor process that will lead it towards the root.
 Each process has variable‘Asked’ which is set to FALSE initially. It is setTRUE only
if REQUEST is sent (for itself ot for neighbors) and not received. If PRIVILEGE
message is received , then it is reset to FALSE.
 Each process Pi maintains request queue called RQi  consists of identities of those
immediate neighbors that have requested for the privilege but have not yet been sent
the token. Maximum size of RQ of node is the number of immediate neighbors +1.
Ensuring Mutual Exclusion in Distributed Systems
Ensuring Mutual Exclusion in Distributed Systems
Ensuring Mutual Exclusion in Distributed Systems

More Related Content

What's hot

Distributed Coordination
Distributed CoordinationDistributed Coordination
Distributed Coordinationsiva krishna
 
Operating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordinationOperating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordinationSyaiful Ahdan
 
Chapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationChapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationWayne Jones Jnr
 
resource management
  resource management  resource management
resource managementAshish Kumar
 
Priority based K-Erlang Distribution Method in Cloud Computing
Priority based K-Erlang Distribution Method in Cloud ComputingPriority based K-Erlang Distribution Method in Cloud Computing
Priority based K-Erlang Distribution Method in Cloud Computingidescitation
 
334839757 task-assignment
334839757 task-assignment334839757 task-assignment
334839757 task-assignmentsachinmore76
 
Process Migration in Heterogeneous Systems
Process Migration in Heterogeneous SystemsProcess Migration in Heterogeneous Systems
Process Migration in Heterogeneous Systemsijsrd.com
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systemsguest61205606
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
Global state recording in Distributed Systems
Global state recording in Distributed SystemsGlobal state recording in Distributed Systems
Global state recording in Distributed SystemsArsnet
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsSachin Chauhan
 
Types of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemTypes of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemDHIVYADEVAKI
 
Understanding and compliance of ietf rfc 3262 reliability
Understanding and compliance of ietf rfc 3262 reliabilityUnderstanding and compliance of ietf rfc 3262 reliability
Understanding and compliance of ietf rfc 3262 reliabilityNikhil Sharma
 

What's hot (18)

Distributed Coordination
Distributed CoordinationDistributed Coordination
Distributed Coordination
 
Operating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordinationOperating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordination
 
Chapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationChapter 18 - Distributed Coordination
Chapter 18 - Distributed Coordination
 
resource management
  resource management  resource management
resource management
 
Priority based K-Erlang Distribution Method in Cloud Computing
Priority based K-Erlang Distribution Method in Cloud ComputingPriority based K-Erlang Distribution Method in Cloud Computing
Priority based K-Erlang Distribution Method in Cloud Computing
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
 
334839757 task-assignment
334839757 task-assignment334839757 task-assignment
334839757 task-assignment
 
Process Migration in Heterogeneous Systems
Process Migration in Heterogeneous SystemsProcess Migration in Heterogeneous Systems
Process Migration in Heterogeneous Systems
 
Ba25315321
Ba25315321Ba25315321
Ba25315321
 
Resource management
Resource managementResource management
Resource management
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systems
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
Global state recording in Distributed Systems
Global state recording in Distributed SystemsGlobal state recording in Distributed Systems
Global state recording in Distributed Systems
 
Rpc
RpcRpc
Rpc
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit Protocols
 
Types of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed SystemTypes of Load distributing algorithm in Distributed System
Types of Load distributing algorithm in Distributed System
 
Understanding and compliance of ietf rfc 3262 reliability
Understanding and compliance of ietf rfc 3262 reliabilityUnderstanding and compliance of ietf rfc 3262 reliability
Understanding and compliance of ietf rfc 3262 reliability
 
OSCh17
OSCh17OSCh17
OSCh17
 

Similar to Ensuring Mutual Exclusion in Distributed Systems

Ch17 OS
Ch17 OSCh17 OS
Ch17 OSC.U
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systemsguest61205606
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systemsguest0f5a7d
 
Advanced os 5th unit
Advanced os 5th unitAdvanced os 5th unit
Advanced os 5th unitMujtaba Ahmed
 
Module 3 (1).pptx
Module 3 (1).pptxModule 3 (1).pptx
Module 3 (1).pptxAmalMR4
 
Mutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's AlgorithmMutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's AlgorithmSouvik Roy
 
Chapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.pptChapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.pptsirajmohammed35
 
Rate.docx
Rate.docxRate.docx
Rate.docxkradha5
 
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdfDC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdfLegesseSamuel
 
Coordination and Agreement .ppt
Coordination and Agreement .pptCoordination and Agreement .ppt
Coordination and Agreement .pptSOURAVKUMAR723356
 
Tcp Reliability Flow Control
Tcp Reliability Flow ControlTcp Reliability Flow Control
Tcp Reliability Flow ControlRam Dutt Shukla
 
Comparative Study of Mutual Exclusion Algorithms in Distributed Systems
Comparative Study of Mutual Exclusion Algorithms in Distributed SystemsComparative Study of Mutual Exclusion Algorithms in Distributed Systems
Comparative Study of Mutual Exclusion Algorithms in Distributed SystemsIJERA Editor
 

Similar to Ensuring Mutual Exclusion in Distributed Systems (20)

Ch17 OS
Ch17 OSCh17 OS
Ch17 OS
 
OS_Ch17
OS_Ch17OS_Ch17
OS_Ch17
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systems
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 
Distributed System
Distributed System Distributed System
Distributed System
 
Retransmission Tcp
Retransmission TcpRetransmission Tcp
Retransmission Tcp
 
Advanced os 5th unit
Advanced os 5th unitAdvanced os 5th unit
Advanced os 5th unit
 
Module 3 (1).pptx
Module 3 (1).pptxModule 3 (1).pptx
Module 3 (1).pptx
 
Mutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's AlgorithmMutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's Algorithm
 
Chapter 6 synchronization
Chapter 6 synchronizationChapter 6 synchronization
Chapter 6 synchronization
 
Raft presentation
Raft presentationRaft presentation
Raft presentation
 
Pdp12
Pdp12Pdp12
Pdp12
 
Chapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.pptChapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.ppt
 
Rate.docx
Rate.docxRate.docx
Rate.docx
 
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdfDC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
 
12EASApril-3412
12EASApril-341212EASApril-3412
12EASApril-3412
 
Hu3513551364
Hu3513551364Hu3513551364
Hu3513551364
 
Coordination and Agreement .ppt
Coordination and Agreement .pptCoordination and Agreement .ppt
Coordination and Agreement .ppt
 
Tcp Reliability Flow Control
Tcp Reliability Flow ControlTcp Reliability Flow Control
Tcp Reliability Flow Control
 
Comparative Study of Mutual Exclusion Algorithms in Distributed Systems
Comparative Study of Mutual Exclusion Algorithms in Distributed SystemsComparative Study of Mutual Exclusion Algorithms in Distributed Systems
Comparative Study of Mutual Exclusion Algorithms in Distributed Systems
 

Recently uploaded

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 

Recently uploaded (20)

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 

Ensuring Mutual Exclusion in Distributed Systems

  • 1. Mutual Exclusion  Ensuring mutual exclusion means that the shared resource(critical region) is exclusively available to one process at any given time.  Requirements of Mutual ExclusionAlgorithms :-  1. Safety Property :At most one process may execute in CR at a time  Liveness Property: a process requesting entry to CR is eventually granted it.There should not be deadlock and starvation.  Fairness : Each process should get a fair chance to execute the CR
  • 2.  Performance Metrics:-  Synchronization delay: - time interval between CR exit and new entry by any process  System throughput :- Rate at which requests for the CR get executed  Message complexity:- Number of messages that are required per CR execution by process  Response time:-Time interval from a request send to its CR execution completed.
  • 3. Classification of Mutual Exclusion Algorithms  Centralized mutual exclusion algorithms- use coordinator to guarantee safety, liveness and fairness properties  Distributed mutual exclusion algorithms- do not use centralized arbitrator. Further classified as  Non token based- exchange messages amongst the processes to determine which process gets to enter the CR.The request for grant of permission to enter may be to all or a subset(quorum) of processes.When the conditions as specified by the algorithm are satisfied , only one process enters the CR at a given time is guaranteed.  Token Based – a unique token is shared among the process.A process is allowed to enter its CR if it possess the token and it continues to hold the token until the execution of the CR is over.
  • 4. Distributed Mutual Exclusion  Distributed Mutual Exclusion algorithm does not use coordinator but uses logical clock for event ordering.The processes coordinate amongst themselves to guarantee mutual exclusion.  1. Non-Token Based  Lamport’s Distribution MutualAlgo  Ricart-Agrawala Algo  Maekawa’sAlgo  2.Token Based o Suzuki-Kasami’s Broadcast Algo o Singhal’s Heuristic Algo
  • 5. Centralized Algorithm  Process send REQUEST to the centralized ,elected coordinator to enter CR  Coordinator acts as an arbitrator and serialization of the requests is guaranteed by it  If no other process is currently executing the CR, variable Grant=F(alse) & Request Queue, Req_Q=E(mpty)  Coordinator grants permission to requesting process by sending REPLY message and granting the permission (variable GRANT=T(rue)).This Process is not allowed to enter the CR.  If CR is being executed by another process when the request for permission arrives , this could be queued (blocking the process) by coordinator or it could reply back to the requesting process with‘permission denied’ message so that process could send the request at some other time.  When process executing CR exits , it sends RELEASE message to coordinator
  • 6.
  • 7.
  • 8. Lamport’s Distributed Mutual Exclusion Algo  Uses Lamport’s timestamp logical clock synchronization mechanism to establish priority amongst the processes/nodes present in the distributed system.  The serialization of the order of processes entering CR(Critical Region) is maintained by FIFO request queue, RQ of each process.  A process Pi Broadcast locally timestamped REQUEST message along with its own identifier.  On receiving the REQUEST, every process inserts this request in its Rqi, which contains all incoming requests.  The requests get inserted at the correct place(based on increasing value of the timestamp).  Pi also inserts this value in its own Rqi.  The queue Rqi at any process Pi maintains the order of processes entering the CR.
  • 9.
  • 10.
  • 11.
  • 12. Performance Parameters  Has message overhead of total 3(N-1): (N-1) Request messages, (N-1) Reply messages, (N-1) Release messages per CR invocation  Can be optimized by reducing the number of RELEASE messages sent.
  • 13. Recart-Agrawala Algorithm  Based on distributed agreement using timestamps  Uses Lamport’s logical clock to synchronize and assign timestamps to its messages  Is similar to Lamport’s Distributed Mutual Exclusion except difference in sending of REPLY messages  Pi sends its REQUEST message with its timestamp and identifier indicating its wish to enter CR  If process receiving request doen not want to enter the CR (nor it is currently executing in the CR), it sends a REPLY message back to the process requesting , granting it, its permission to enter.  If REPLY comes back from all processes , only then the requesting process enters the CR.  If the receiving process itself wants to enter the critical region , the timestamp of REQUEST message and its own timestamp are compared to establish the priority.The requesting process’ REPLY is deferred if its own timestamp is lower.
  • 14.
  • 15.
  • 16. Performance Parameters  The algorithm does not use explicit RELEASE messages.The dequeuing is done on the receipt of REPLY itself.Thus total message overhead would be 2(N-1) messages, i.e. for entering a CR, (N-1) request and exiting (N-1) replies.  The failure of any process almost halts the algorithm as it requires all replies.
  • 17. Maekawa’s Algorithm  Is a quorum or voting based exclusion algorithm.  Pi does not require to request all processes but only to a subset of processes i.e quorum called Ri.  Each process Pi in the quorum set Ri gives permission to at most one process at a time.
  • 18.
  • 20.  Data structures used by each process Pi, 1. The request deferred queue, Rdi (of processes REQUESTing and not REPLIED to) 2. A variable called‘Voted’=F(ALSE) is set initially (T(RUE) when a reply is sent indicating that it has already granted permission to process in its quorum)
  • 21.
  • 23.  Process P1 and Process P3 want to enter CR. Both these processes send their respective REQUEST messages to their quorum set R1and R3 waiting for REPLY from all the set members.  Let’s say the REQUEST message of P1 reaches P4 earlier and as there is no other REQUEST message prior to this message at P4(RD4=empty), theVoted4 variable is False. So REPLY is sent back to P1,nowVoted4 in P4 is set toTRUE.  Meanwhile the REQUEST message of P3 also reaches P2 and in the same way, P2 sends REPLY to P3 and sets its ownVoted2 variable toTRUE. Now waits for a REPLY from P2, which cannot be sent (VOTED2 isTRUE)  Thus the request of P1 is deferred and the deferred queue of P2 now has an entry of P1(RD2[1]=P1). Similarly the REPLY can’t be sent to process P3 by P4 and deferred queue of process P3 is RD4[1]=P3. so now P1 is waiting for P2’s REPLY,P2 for P3’s RELEASE,P3 for P4’s REPLY and P4 for P1’s RELEASE,thus resulting in deadlock.
  • 24. Performance Parameters  An execution of CR requires √N REQUEST, √N REPLY and √N RELEASE messages thus requiring total 3 √N messages per CR execution.  Synchronization delay is 2T  M=K= √N works best.
  • 25. Suzuki-Kasami Broadcast Algo  Token Base Algorithm  Process holding theTOKEN can enter CR.  Basic idea is to contact every process in completely connected network of P processes, and gather the grant REPLYs from all to establish mutual exclusion.  Process not having token , wants to enter the CR , it has to broadcast its request for granting permission to all processes using primitive REQUEST for token.  REQUEST(i,n)  i is the process identifier and n sequence number of the request it is sending. E.g. REQUEST(3,4)  process 3 requesting and this is its fourth request.
  • 26. Data structures used  By process Pi  Request array Ri[j]; j=1 to N processes e.g. R2[3]=5 Process 2 knows that process 3 has sent 5 requests for entering CR to Process 2. When Process Pi receives REQUEST(j,n) message , it sets Ri[j]=max (Ri[j],n). The current request is termed outdated, if the valueTi[j] is greater than n. e.g P2 receives REQUEST(3,4, n-4 indicating its 4th request. IfR2[3]=5, meaning that P2 has already seen 5 requests earlier fromP3.As R2[3]=5>n=4, this 4th request is termed as outdated request.
  • 27. Data structures used  By token  Token arrayToken[i]  maintains the number of times the ith process has executed critical region. e.g Token[1]=6 means that token was given to process 1 and its sixth REQUEST of entering CR. Previously 5 times request was present. Once process Pi holding the token exits the CR, the value of this array for the process holding token is updated with knowledge of process.Also if Ri[j]=token[j]+1 , then process Pi is currently requesting a token.  Queue QT  contains queue of the processes requesting token.The process at the top os this is the one to which token is sent next.
  • 28.
  • 29.
  • 30.
  • 31. Singhal’s Heuristic Algorithm  Suzuku-Kasami’s algo having N messages for just obtaining the token  This method proposes to reduce this number by applying heuristic method , i.e. having knowledge about each process’ current state and sending the token request accordingly.  The process could be in any of the following  E Executing and having the token H Holding the token and not executing R Requesting the token N Neutral, none of the above  The algorithm selects the processes which have more probability of having the token and requesting process then sends the request to only selected ones rather than broadcasting reducing number of messages  This is called heuristic algo as processes are heuristically selected for sending token request messages, according to their current states.
  • 32.
  • 33.  For example, if k is chosen to be 2, then the processes having IDs 2 and above(i>=k) are in neutral state, process P1 (i<k) would be only process in R state.  Thus if process P2, now wishes to enter the critical region , the REQUEST message requires to be sent only to 1 as there is no need to send the REQUEST for the permission grant to others as they never requested to enter in CR in the first place.
  • 34.
  • 35. Raymond’s Tree-Based Algorithm  Use minimal spanning tree for sending the REQUEST message to the process which is holding token  The spanning tree– N nodes/process is viewed as a graph; nodes/processes as vertices and links as edges of the network  Path from every node to every other node; the shortest path is the minimal spanning tree  Tree arranged as rooted tree; the process holding token has privilege to be root
  • 36.  Each process maintains HOLDER variable H, which points to the root or its own neighbor process that will lead it towards the root.  Each process has variable‘Asked’ which is set to FALSE initially. It is setTRUE only if REQUEST is sent (for itself ot for neighbors) and not received. If PRIVILEGE message is received , then it is reset to FALSE.  Each process Pi maintains request queue called RQi  consists of identities of those immediate neighbors that have requested for the privilege but have not yet been sent the token. Maximum size of RQ of node is the number of immediate neighbors +1.