SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
Clock Synchronization
Physical Clocks
1 The time difference between two computers is known as drift. Clock drift
over time is known as skew.
2
Logical Clocks
Often, it is not necessary for a computer to know the exact time, only relative time.
This is known as “logical time”.
Logical time is not based on timing but on the ordering of events.
Non-interacting processes cannot share a logical clock.
Computers generally obtain logical time using interrupts to update a software clock.
The more interrupts (the more frequently time is updated), the higher the overhead.
Process Synchroniztion
Process synchronization is the set of techniques that are used to coordinate
execution among processes. For example, a process may need to run to a certain
point, at which point it will stop and wait for another process to finish certain
actions. A shared resource, such as a file or fields in a database, may require
exclusive access and processes have to coordinate among themselves to ensure that
access to the resource is fair and exclusive.
Distributed processes often need to coordinate their activities.
If a collection of processes share a resource or collection of resources, then often
mutual exclusion is required to prevent interference and ensure consistency when
accessing the resources.
Critical Section (CS)
enter(): enter a critical section - block if necessary.
resourceAccess(): access shared resources in critical section.
exit(): leave critical section - other processes may now enter.
In computer science, mutual exclusion (MUTEX) refers to a way of making sure that
if one process is using shared modifiable data or resources then the other processes
will be excluded from doing the same thing at the same time. A number of mutual
exclusion algorithms are available in the literature, with different performance
metrics and with different techniques. The Selection for a “good” mutual exclusion
algorithm is a key point. These mutual exclusion algorithms can be broadly
classified into token and non-token based algorithm.
Distributed Mutual Exclusion
Any viable mutual exclusion algorithm must satisfy three properties:
Safety
At any instant, only one process may hold the resource.
Liveness
Processes should not wait forever for messages that will never arrive.
Ordering
If one request to enter the CS happened-before another, then entry to the CS is
granted in that order.
1. Token based approaches
 A unique token (PRIVILEGE msg) is shared among the processes.
 A process is allowed to enter its CS if it possesses the token.
 Centralized Algorithm
 Ring Based Algorithms
Centralized Algorithm
One process is elected as the coordinator.
When any process wants to enter a critical section, it sends a request message to the
coordinator stating which critical section it wants to access.
If no other process is currently in that critical section, the coordinator sends back a
reply granting permission. When the reply arrives, the requesting process enters the
critical section. If another process requests access to the same critical section, it is
ignored or blocked until the first process exits the critical section and sends a
message to the coordinator stating that it has exited.
Ring Based Algorithms
Another approach is to create a logical or physical ring.
Each process knows the identity of the process succeeding it.
When the ring is initialized, Process 0 is given a token. The token circulates around
the ring in order, from Process k to Process k + 1.
When a process receives the token from its neighbor, it checks to see if it is
attempting to enter a critical section. If so, the process enters the critical section and
does its work, keeping the token the whole time.
After the process exits the critical section, it passes the token to the next process in
the ring. It is not permitted to enter a second critical section using the same token.
If a process is handed a token an is not interested in entering a critical section, it
passes the token to the next process.
Distributed Algorithms
It is often unacceptable to have a single point of failure. Therefore researchers
continue to look for distributed mutual exclusion algorithms.
2. Non Token based approaches
Two or more successive rounds of messages are exchanged among the processes
to determine which process will enter the CS next.
Lamport’s mutual exclusion algorithm
• In this algorithm, every process in the group maintains a request queue.
There is a list of processes (p1,p2,p3) that want to access a resource.
• All messages are sent reliably and in FIFO order and each message is time
stamped with unique Lamport timestamps. All items in the request queues
are sorted by message timestamps.
• The basic mechanism of this algorithm is that a process that wants to use the
resource sends a timestamped request for the resource to all group members
as well as to itself.
• Every recipient adds the received request to its request queue, which is sorted
in timestamp order. Because all processes get all request messages, all
timestamps are unique, and all queues are sorted, every process has the exact
same items on its queue.
• If a process sees itself at the head of the queue, it knows that it can access the
resource: no other process will be at the head of the queue.
• When it is done, it sends a release message to all group members and removes
its ID from its local queue.
• Each group member, upon receiving a release message, removes that process
ID from the request queue and checks to see whether it is at the head of the
queue and can access the resource.
Distributed Mutual exclusion algorithms
• Lamport’s algorithm is not a great one. We replaced the single point of failure
of the centralized algorithm with an algorithm that has N points of failure.
• In addition, there is a lot of messaging traffic. Each request requires sending
N–1 messages (one to each group member) and getting N–1
acknowledgements.
• Finally, when a resource lock is released, a process must send N–1 release
messages.
Ricart and Agrawala:
• There must be a total ordering of all events in the system. Lamport’s
Algorithm can be used for this purpose.
• When a process wants to enter a critical section, it builds a message
containing the name of the critical section, its process number, and the
current time. It then sends the message (broadcast) to all other processes, as
well as to itself.
1 When a process receives a request message, the action it takes depends on its
state with respect to the critical section named in the message.
2
There are three cases:
1. If the receiver is not in the critical section and does not want to enter it, it
sends an OK message to the sender.
2. If the receiver is in the critical section, it does not reply. It instead queues the
request.
3. If the receiver also wants to enter the same critical section, it compares the
time stamp in the incoming message with the time stamp in the message it has sent
out. The lowest time stamp wins. If its own message has a lower time stamp, it does
not reply and queues the request from the sending process.
When a process has received OK messages from all other processes, it enters the
critical section. Upon exiting the critical section, it sends OK messages to all
processes in its queue and deletes them all from the queue.
Distributed Mutual exclusion algorithms
Distributed Mutual exclusion algorithms

More Related Content

DOC
Unit 1 architecture of distributed systems
PPTX
Fault tolerance in distributed systems
PPT
Clock synchronization in distributed system
PPTX
Software Configuration Management
PPT
Types of Load distributing algorithm in Distributed System
PDF
Chapter 11d coordination agreement
PPT
Deadlock
PPTX
Fuel cells
Unit 1 architecture of distributed systems
Fault tolerance in distributed systems
Clock synchronization in distributed system
Software Configuration Management
Types of Load distributing algorithm in Distributed System
Chapter 11d coordination agreement
Deadlock
Fuel cells

What's hot (20)

PPTX
Replication in Distributed Systems
PDF
CS6601 DISTRIBUTED SYSTEMS
PDF
Agreement Protocols, distributed File Systems, Distributed Shared Memory
PPT
distributed shared memory
PDF
8. mutual exclusion in Distributed Operating Systems
PPTX
Message and Stream Oriented Communication
PDF
Distributed deadlock
PPTX
Distributed Mutual Exclusion and Distributed Deadlock Detection
PPTX
Distributed DBMS - Unit 5 - Semantic Data Control
PPTX
Stream oriented communication
PDF
Deadlock in Distributed Systems
PPTX
Semantic net in AI
PDF
Design issues of dos
PPTX
Synchronization Pradeep K Sinha
PDF
Artificial Intelligence - Hill climbing.
PPTX
Vector clock algorithm
PPT
Mutual Exclusion Election (Distributed computing)
PPTX
Load Balancing In Distributed Computing
PPT
Communication primitives
PPTX
Distributed concurrency control
Replication in Distributed Systems
CS6601 DISTRIBUTED SYSTEMS
Agreement Protocols, distributed File Systems, Distributed Shared Memory
distributed shared memory
8. mutual exclusion in Distributed Operating Systems
Message and Stream Oriented Communication
Distributed deadlock
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed DBMS - Unit 5 - Semantic Data Control
Stream oriented communication
Deadlock in Distributed Systems
Semantic net in AI
Design issues of dos
Synchronization Pradeep K Sinha
Artificial Intelligence - Hill climbing.
Vector clock algorithm
Mutual Exclusion Election (Distributed computing)
Load Balancing In Distributed Computing
Communication primitives
Distributed concurrency control
Ad

Similar to Distributed Mutual exclusion algorithms (20)

PPTX
Communication And Synchronization In Distributed Systems
PPTX
Distributed Systems
PPTX
Communication And Synchronization In Distributed Systems
PDF
Comparative Study of Mutual Exclusion Algorithms in Distributed Systems
PDF
Analysis of mutual exclusion algorithms with the significance and need of ele...
PPTX
Synchronization
PDF
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
DOCX
Operating System- INTERPROCESS COMMUNICATION.docx
PPTX
Process management in Operating System_Unit-2
PDF
Process coordination
PPTX
Lecture 3 Inter Process Communication.pptx
PPT
Ch17 OS
 
PPT
PPTX
Lecture 5 inter process communication
PDF
A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...
PPT
dos mutual exclusion algos
PPTX
Concurrency Control in Distributed Systems.pptx
PPTX
operating system notes of unit 3 explanation
PDF
Advanced os 5th unit
Communication And Synchronization In Distributed Systems
Distributed Systems
Communication And Synchronization In Distributed Systems
Comparative Study of Mutual Exclusion Algorithms in Distributed Systems
Analysis of mutual exclusion algorithms with the significance and need of ele...
Synchronization
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
Operating System- INTERPROCESS COMMUNICATION.docx
Process management in Operating System_Unit-2
Process coordination
Lecture 3 Inter Process Communication.pptx
Ch17 OS
 
Lecture 5 inter process communication
A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...
dos mutual exclusion algos
Concurrency Control in Distributed Systems.pptx
operating system notes of unit 3 explanation
Advanced os 5th unit
Ad

More from MNM Jain Engineering College (17)

DOCX
IT8602 MOBILE COMMUNICATION.docx
PDF
IT8602 Syllabus.pdf
DOC
PDF
DOC
Task assignment approach
PPT
Process Management-Process Migration
DOC
Naming in Distributed System
PPT
Peer to Peer services and File systems
PPT
Remote method invocation
PPT
Remote Procedure Call
PPT
Engineering Ethics
PPT
Distributed System-Multicast & Indirect communication
DOCX
It6312 dbms lab-ex2
DOCX
Expected questions in Artificial Intelligence
PDF
Qp mobile & pervasive 2015
DOC
It6611 mobile application development laboratory l t p c0 0 3 2
PDF
Instruction formats-in-8086
IT8602 MOBILE COMMUNICATION.docx
IT8602 Syllabus.pdf
Task assignment approach
Process Management-Process Migration
Naming in Distributed System
Peer to Peer services and File systems
Remote method invocation
Remote Procedure Call
Engineering Ethics
Distributed System-Multicast & Indirect communication
It6312 dbms lab-ex2
Expected questions in Artificial Intelligence
Qp mobile & pervasive 2015
It6611 mobile application development laboratory l t p c0 0 3 2
Instruction formats-in-8086

Recently uploaded (20)

PDF
6th International Conference on Artificial Intelligence and Machine Learning ...
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
PPTX
Simulation of electric circuit laws using tinkercad.pptx
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
PDF
Principles of Food Science and Nutritions
PDF
Queuing formulas to evaluate throughputs and servers
PDF
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Introduction to Data Science: data science process
PDF
BRKDCN-2613.pdf Cisco AI DC NVIDIA presentation
PPT
Ppt for engineering students application on field effect
PPTX
Ship’s Structural Components.pptx 7.7 Mb
PPTX
The-Looming-Shadow-How-AI-Poses-Dangers-to-Humanity.pptx
PDF
Chad Ayach - A Versatile Aerospace Professional
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PDF
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
PDF
B.Tech (Electrical Engineering ) 2024 syllabus.pdf
PPTX
Security-Responsibilities-in-the-Cloud-Azure-Shared-Responsibility-Model.pptx
PDF
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
6th International Conference on Artificial Intelligence and Machine Learning ...
July 2025: Top 10 Read Articles Advanced Information Technology
Simulation of electric circuit laws using tinkercad.pptx
dse_final_merit_2025_26 gtgfffffcjjjuuyy
Principles of Food Science and Nutritions
Queuing formulas to evaluate throughputs and servers
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Introduction to Data Science: data science process
BRKDCN-2613.pdf Cisco AI DC NVIDIA presentation
Ppt for engineering students application on field effect
Ship’s Structural Components.pptx 7.7 Mb
The-Looming-Shadow-How-AI-Poses-Dangers-to-Humanity.pptx
Chad Ayach - A Versatile Aerospace Professional
Lesson 3_Tessellation.pptx finite Mathematics
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
B.Tech (Electrical Engineering ) 2024 syllabus.pdf
Security-Responsibilities-in-the-Cloud-Azure-Shared-Responsibility-Model.pptx
A Framework for Securing Personal Data Shared by Users on the Digital Platforms

Distributed Mutual exclusion algorithms

  • 1. Clock Synchronization Physical Clocks 1 The time difference between two computers is known as drift. Clock drift over time is known as skew. 2 Logical Clocks Often, it is not necessary for a computer to know the exact time, only relative time. This is known as “logical time”. Logical time is not based on timing but on the ordering of events. Non-interacting processes cannot share a logical clock. Computers generally obtain logical time using interrupts to update a software clock. The more interrupts (the more frequently time is updated), the higher the overhead.
  • 2. Process Synchroniztion Process synchronization is the set of techniques that are used to coordinate execution among processes. For example, a process may need to run to a certain point, at which point it will stop and wait for another process to finish certain actions. A shared resource, such as a file or fields in a database, may require exclusive access and processes have to coordinate among themselves to ensure that access to the resource is fair and exclusive. Distributed processes often need to coordinate their activities. If a collection of processes share a resource or collection of resources, then often mutual exclusion is required to prevent interference and ensure consistency when accessing the resources. Critical Section (CS) enter(): enter a critical section - block if necessary. resourceAccess(): access shared resources in critical section. exit(): leave critical section - other processes may now enter. In computer science, mutual exclusion (MUTEX) refers to a way of making sure that if one process is using shared modifiable data or resources then the other processes will be excluded from doing the same thing at the same time. A number of mutual exclusion algorithms are available in the literature, with different performance metrics and with different techniques. The Selection for a “good” mutual exclusion algorithm is a key point. These mutual exclusion algorithms can be broadly classified into token and non-token based algorithm. Distributed Mutual Exclusion Any viable mutual exclusion algorithm must satisfy three properties: Safety At any instant, only one process may hold the resource. Liveness Processes should not wait forever for messages that will never arrive. Ordering If one request to enter the CS happened-before another, then entry to the CS is granted in that order.
  • 3. 1. Token based approaches  A unique token (PRIVILEGE msg) is shared among the processes.  A process is allowed to enter its CS if it possesses the token.  Centralized Algorithm  Ring Based Algorithms Centralized Algorithm One process is elected as the coordinator. When any process wants to enter a critical section, it sends a request message to the coordinator stating which critical section it wants to access. If no other process is currently in that critical section, the coordinator sends back a reply granting permission. When the reply arrives, the requesting process enters the critical section. If another process requests access to the same critical section, it is ignored or blocked until the first process exits the critical section and sends a message to the coordinator stating that it has exited. Ring Based Algorithms Another approach is to create a logical or physical ring. Each process knows the identity of the process succeeding it. When the ring is initialized, Process 0 is given a token. The token circulates around the ring in order, from Process k to Process k + 1. When a process receives the token from its neighbor, it checks to see if it is attempting to enter a critical section. If so, the process enters the critical section and does its work, keeping the token the whole time.
  • 4. After the process exits the critical section, it passes the token to the next process in the ring. It is not permitted to enter a second critical section using the same token. If a process is handed a token an is not interested in entering a critical section, it passes the token to the next process. Distributed Algorithms It is often unacceptable to have a single point of failure. Therefore researchers continue to look for distributed mutual exclusion algorithms. 2. Non Token based approaches Two or more successive rounds of messages are exchanged among the processes to determine which process will enter the CS next. Lamport’s mutual exclusion algorithm • In this algorithm, every process in the group maintains a request queue. There is a list of processes (p1,p2,p3) that want to access a resource. • All messages are sent reliably and in FIFO order and each message is time stamped with unique Lamport timestamps. All items in the request queues are sorted by message timestamps. • The basic mechanism of this algorithm is that a process that wants to use the resource sends a timestamped request for the resource to all group members as well as to itself. • Every recipient adds the received request to its request queue, which is sorted in timestamp order. Because all processes get all request messages, all timestamps are unique, and all queues are sorted, every process has the exact same items on its queue.
  • 5. • If a process sees itself at the head of the queue, it knows that it can access the resource: no other process will be at the head of the queue. • When it is done, it sends a release message to all group members and removes its ID from its local queue. • Each group member, upon receiving a release message, removes that process ID from the request queue and checks to see whether it is at the head of the queue and can access the resource.
  • 7. • Lamport’s algorithm is not a great one. We replaced the single point of failure of the centralized algorithm with an algorithm that has N points of failure. • In addition, there is a lot of messaging traffic. Each request requires sending N–1 messages (one to each group member) and getting N–1 acknowledgements. • Finally, when a resource lock is released, a process must send N–1 release messages. Ricart and Agrawala: • There must be a total ordering of all events in the system. Lamport’s Algorithm can be used for this purpose. • When a process wants to enter a critical section, it builds a message containing the name of the critical section, its process number, and the current time. It then sends the message (broadcast) to all other processes, as well as to itself. 1 When a process receives a request message, the action it takes depends on its state with respect to the critical section named in the message. 2
  • 8. There are three cases: 1. If the receiver is not in the critical section and does not want to enter it, it sends an OK message to the sender. 2. If the receiver is in the critical section, it does not reply. It instead queues the request. 3. If the receiver also wants to enter the same critical section, it compares the time stamp in the incoming message with the time stamp in the message it has sent out. The lowest time stamp wins. If its own message has a lower time stamp, it does not reply and queues the request from the sending process. When a process has received OK messages from all other processes, it enters the critical section. Upon exiting the critical section, it sends OK messages to all processes in its queue and deletes them all from the queue.