SlideShare a Scribd company logo
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.
• 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

What's hot

Distributed System Management
Distributed System ManagementDistributed System Management
Distributed System ManagementIbrahim Amer
 
Synchronization Pradeep K Sinha
Synchronization Pradeep K SinhaSynchronization Pradeep K Sinha
Synchronization Pradeep K SinhaJawwad Rafiq
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSKathirvel Ayyaswamy
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memoryAshish Kumar
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSKathirvel Ayyaswamy
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems SHATHAN
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systemssumitjain2013
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure callsAshish Kumar
 
2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software conceptsPrajakta Rane
 
Aggrement protocols
Aggrement protocolsAggrement protocols
Aggrement protocolsMayank Jain
 
Distributed system lamport's and vector algorithm
Distributed system lamport's and vector algorithmDistributed system lamport's and vector algorithm
Distributed system lamport's and vector algorithmpinki soni
 
Message and Stream Oriented Communication
Message and Stream Oriented CommunicationMessage and Stream Oriented Communication
Message and Stream Oriented CommunicationDilum Bandara
 
Foult Tolerence In Distributed System
Foult Tolerence In Distributed SystemFoult Tolerence In Distributed System
Foult Tolerence In Distributed SystemRajan Kumar
 
Clock Synchronization in Distributed Systems
Clock Synchronization in Distributed SystemsClock Synchronization in Distributed Systems
Clock Synchronization in Distributed SystemsZbigniew Jerzak
 
Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)Sri Prasanna
 

What's hot (20)

Distributed System Management
Distributed System ManagementDistributed System Management
Distributed System Management
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
Synchronization Pradeep K Sinha
Synchronization Pradeep K SinhaSynchronization Pradeep K Sinha
Synchronization Pradeep K Sinha
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 
message passing
 message passing message passing
message passing
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systems
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure calls
 
2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts
 
Aggrement protocols
Aggrement protocolsAggrement protocols
Aggrement protocols
 
Distributed system lamport's and vector algorithm
Distributed system lamport's and vector algorithmDistributed system lamport's and vector algorithm
Distributed system lamport's and vector algorithm
 
Message and Stream Oriented Communication
Message and Stream Oriented CommunicationMessage and Stream Oriented Communication
Message and Stream Oriented Communication
 
Foult Tolerence In Distributed System
Foult Tolerence In Distributed SystemFoult Tolerence In Distributed System
Foult Tolerence In Distributed System
 
Clock Synchronization in Distributed Systems
Clock Synchronization in Distributed SystemsClock Synchronization in Distributed Systems
Clock Synchronization in Distributed Systems
 
11. dfs
11. dfs11. dfs
11. dfs
 
Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)Logical Clocks (Distributed computing)
Logical Clocks (Distributed computing)
 

Similar to Distributed Mutual exclusion algorithms

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
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systemsguest61205606
 
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
 
Analysis of mutual exclusion algorithms with the significance and need of ele...
Analysis of mutual exclusion algorithms with the significance and need of ele...Analysis of mutual exclusion algorithms with the significance and need of ele...
Analysis of mutual exclusion algorithms with the significance and need of ele...Govt. P.G. College Dharamshala
 
Synchronization
SynchronizationSynchronization
SynchronizationSara shall
 
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
 
Operating System- INTERPROCESS COMMUNICATION.docx
Operating System- INTERPROCESS COMMUNICATION.docxOperating System- INTERPROCESS COMMUNICATION.docx
Operating System- INTERPROCESS COMMUNICATION.docxminaltmv
 
Process management in Operating System_Unit-2
Process management in Operating System_Unit-2Process management in Operating System_Unit-2
Process management in Operating System_Unit-2mohanaps
 
Ch17 OS
Ch17 OSCh17 OS
Ch17 OSC.U
 
A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...
A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...
A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...Neelamani Samal
 
dos mutual exclusion algos
dos mutual exclusion algosdos mutual exclusion algos
dos mutual exclusion algosAkhil Sharma
 
Concurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptxConcurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptxMArshad35
 
Advanced os 5th unit
Advanced os 5th unitAdvanced os 5th unit
Advanced os 5th unitMujtaba Ahmed
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)WajeehaBaig
 
Distributed systems_important 2marks.docx
Distributed systems_important 2marks.docxDistributed systems_important 2marks.docx
Distributed systems_important 2marks.docx20TUCS251VIJAYASHARA
 

Similar to Distributed Mutual exclusion algorithms (20)

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
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systems
 
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
 
Analysis of mutual exclusion algorithms with the significance and need of ele...
Analysis of mutual exclusion algorithms with the significance and need of ele...Analysis of mutual exclusion algorithms with the significance and need of ele...
Analysis of mutual exclusion algorithms with the significance and need of ele...
 
Synchronization
SynchronizationSynchronization
Synchronization
 
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
 
Operating System- INTERPROCESS COMMUNICATION.docx
Operating System- INTERPROCESS COMMUNICATION.docxOperating System- INTERPROCESS COMMUNICATION.docx
Operating System- INTERPROCESS COMMUNICATION.docx
 
Process management in Operating System_Unit-2
Process management in Operating System_Unit-2Process management in Operating System_Unit-2
Process management in Operating System_Unit-2
 
Process coordination
Process coordinationProcess coordination
Process coordination
 
Ch17 OS
Ch17 OSCh17 OS
Ch17 OS
 
OS_Ch17
OS_Ch17OS_Ch17
OS_Ch17
 
OSCh17
OSCh17OSCh17
OSCh17
 
Lecture 5 inter process communication
Lecture 5 inter process communicationLecture 5 inter process communication
Lecture 5 inter process communication
 
A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...
A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...
A fault tolerant tokenbased atomic broadcast algorithm relying on responsive ...
 
dos mutual exclusion algos
dos mutual exclusion algosdos mutual exclusion algos
dos mutual exclusion algos
 
Concurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptxConcurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptx
 
Advanced os 5th unit
Advanced os 5th unitAdvanced os 5th unit
Advanced os 5th unit
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
 
Distributed systems_important 2marks.docx
Distributed systems_important 2marks.docxDistributed systems_important 2marks.docx
Distributed systems_important 2marks.docx
 

More from MNM Jain Engineering College

Distributed System-Multicast & Indirect communication
Distributed System-Multicast & Indirect communicationDistributed System-Multicast & Indirect communication
Distributed System-Multicast & Indirect communicationMNM Jain Engineering College
 
It6611 mobile application development laboratory l t p c0 0 3 2
It6611 mobile application development laboratory l t p c0 0 3 2It6611 mobile application development laboratory l t p c0 0 3 2
It6611 mobile application development laboratory l t p c0 0 3 2MNM Jain Engineering College
 

More from MNM Jain Engineering College (17)

IT8602 MOBILE COMMUNICATION.docx
IT8602 MOBILE COMMUNICATION.docxIT8602 MOBILE COMMUNICATION.docx
IT8602 MOBILE COMMUNICATION.docx
 
IT8602 Syllabus.pdf
IT8602 Syllabus.pdfIT8602 Syllabus.pdf
IT8602 Syllabus.pdf
 
Mg8591 syllabus
Mg8591 syllabusMg8591 syllabus
Mg8591 syllabus
 
Ccse ii model_qp
Ccse ii model_qpCcse ii model_qp
Ccse ii model_qp
 
Task assignment approach
Task assignment approachTask assignment approach
Task assignment approach
 
Process Management-Process Migration
Process Management-Process MigrationProcess Management-Process Migration
Process Management-Process Migration
 
Naming in Distributed System
Naming in Distributed SystemNaming in Distributed System
Naming in Distributed System
 
Peer to Peer services and File systems
Peer to Peer services and File systemsPeer to Peer services and File systems
Peer to Peer services and File systems
 
Remote method invocation
Remote method invocationRemote method invocation
Remote method invocation
 
Remote Procedure Call
Remote Procedure CallRemote Procedure Call
Remote Procedure Call
 
Engineering Ethics
Engineering EthicsEngineering Ethics
Engineering Ethics
 
Distributed System-Multicast & Indirect communication
Distributed System-Multicast & Indirect communicationDistributed System-Multicast & Indirect communication
Distributed System-Multicast & Indirect communication
 
It6312 dbms lab-ex2
It6312 dbms lab-ex2It6312 dbms lab-ex2
It6312 dbms lab-ex2
 
Expected questions in Artificial Intelligence
Expected questions in Artificial IntelligenceExpected questions in Artificial Intelligence
Expected questions in Artificial Intelligence
 
Qp mobile & pervasive 2015
Qp mobile & pervasive 2015Qp mobile & pervasive 2015
Qp mobile & pervasive 2015
 
It6611 mobile application development laboratory l t p c0 0 3 2
It6611 mobile application development laboratory l t p c0 0 3 2It6611 mobile application development laboratory l t p c0 0 3 2
It6611 mobile application development laboratory l t p c0 0 3 2
 
Instruction formats-in-8086
Instruction formats-in-8086Instruction formats-in-8086
Instruction formats-in-8086
 

Recently uploaded

ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfKamal Acharya
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
 
KIT-601 Lecture Notes-UNIT-3.pdf Mining Data Stream
KIT-601 Lecture Notes-UNIT-3.pdf Mining Data StreamKIT-601 Lecture Notes-UNIT-3.pdf Mining Data Stream
KIT-601 Lecture Notes-UNIT-3.pdf Mining Data StreamDr. Radhey Shyam
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringC Sai Kiran
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Aryaabh.arya
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdfKamal Acharya
 
School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdfKamal Acharya
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-IVigneshvaranMech
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdfKamal Acharya
 
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringKIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringDr. Radhey Shyam
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdfKamal Acharya
 
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...Amil baba
 
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfA CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfKamal Acharya
 
retail automation billing system ppt.pptx
retail automation billing system ppt.pptxretail automation billing system ppt.pptx
retail automation billing system ppt.pptxfaamieahmd
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationDr. Radhey Shyam
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdfKamal Acharya
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringC Sai Kiran
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.PrashantGoswami42
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edgePaco Orozco
 

Recently uploaded (20)

ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
KIT-601 Lecture Notes-UNIT-3.pdf Mining Data Stream
KIT-601 Lecture Notes-UNIT-3.pdf Mining Data StreamKIT-601 Lecture Notes-UNIT-3.pdf Mining Data Stream
KIT-601 Lecture Notes-UNIT-3.pdf Mining Data Stream
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdf
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and ClusteringKIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
KIT-601 Lecture Notes-UNIT-4.pdf Frequent Itemsets and Clustering
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdf
 
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
 
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfA CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
 
retail automation billing system ppt.pptx
retail automation billing system ppt.pptxretail automation billing system ppt.pptx
retail automation billing system ppt.pptx
 
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and VisualizationKIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
KIT-601 Lecture Notes-UNIT-5.pdf Frame Works and Visualization
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 

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.
  • 6.
  • 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.