SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Distributed Mutual Exclusion
• Synchronization in Distributed Systems
Synchronization in distributed systems are often more difficult
compared to synchronization in uniprocessor and multiprocessor
systems.
Synchronization in Distributed
Systems
 Synchronization in time – achieved by Clock
Synchronization algorithms
 Synchronization between resources - Mutual
Exclusion algorithms
 Synchronization in activities - Distributed
Transaction paradigms
Distributed Mutual Exclusion
 Mutual Exclusion
Mutual exclusion (often abbreviated to mutex) algorithms are
used in concurrent programming to avoid the simultaneous use
of a common resource, such as a global variable, by pieces
of computer code called critical sections.
Distributed Mutual Exclusion
 Critical Sections
In concurrent programming a critical section is a piece of code
that accesses a shared resource (data structure or device) that
must not be concurrently accessed by more than one thread of
execution. A critical section will usually terminate in fixed
time, and a thread, task or process will only have to wait a fixed
time to enter it. Some synchronization mechanism is required at
the entry and exit of the critical section to ensure exclusive
use, for example a semaphore.
Distributed Mutual Exclusion
 Achieving Mutual exclusion
 Hardware solutions - Disabling interrupts on entry into the
critical section
 System variables - By using semaphores implemented as
Locks
 Software solutions - Mutual Exclusion Algorithms
Distributed Mutual Exclusion
 Mutual Exclusion Algorithms
 Centralized algorithms
 Distributed algorithms
 Token ring algorithm
Mutual Exclusion – centralized Algorithm
a) Process 1 asks the coordinator for permission to enter a critical
region. Permission is granted
b) Process 2 then asks permission to enter the same critical
region. The coordinator does not reply.
c) When process 1 exits the critical region, it tells the
coordinator, when then replies to 2
Centralized Algorithm – Advantages Vs
Disadvantages
 Advantages
 Fair algorithm, grants in the order of requests
 The scheme is easy to implement
 Scheme can be used for general resource allocation
 Shortcomings
 Single point of failure. No fault tolerance
 Confusion between No-reply and permission denied
 Performance bottleneck of single co-ordinator in a large
system
Mutual Exclusion – Distributed Algorithm
a) Two processes want to enter the same critical region at the
same moment.
b) Process 0 has the lowest timestamp, so it wins.
c) When process 0 is done, it sends an OK also, so 2 can now
enter the critical region.
Distributed Algorithm – Advantages Vs
Disadvantages
 Advantages
 Single point of failure is overcome by keeping the system
running even if one processes fail
 No bottleneck on one process
 Shortcomings
 2(n-1) messages or more than that
 Waiting for n-1 processes to accept is overkill
 Improvements
 Group membership for easy communication
A Token Ring Algorithm
a) An unordered group of processes on a
network.
b) A logical ring constructed in software.
Token Ring Algorithm – Advantages Vs
Disadvantages
 Advantages
 No co-ordinator and does not depend on other
processes
 On Crash token is just passed on to the neighbour
 Shortcomings
 Only a physical Q, no logical Q
 Loss of token – Regeneration of tokens
 Difficulty in finding the token crash – The
processor might be alive
Comparison
 A comparison of three mutual exclusion algorithms.
Algorithm
Messages per
entry/exit
Delay before entry
(in message times)
Problems
Centralized 3 2 Coordinator crash
Distributed 2 ( n – 1 ) 2 ( n – 1 ) Overkill in waiting
Token ring 1 to 0 to n – 1
Lost token on
process crash
References
 Distributed systems – Principles and Paradigms
– Andrew S Tanenbaum
 A Survey of Mutual-Exclusion Algorithms for
Multiprocessor Operating Systems
http://www.teamten.com/lawrence/242.paper/242.paper.html

Weitere ähnliche Inhalte

Was ist angesagt?

Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systems
karan2190
 
Fault Tolerance System
Fault Tolerance SystemFault Tolerance System
Fault Tolerance System
Ehsan Ilahi
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systems
sumitjain2013
 

Was ist angesagt? (20)

Distributed system Tanenbaum chapter 1,2,3,4 notes
Distributed system Tanenbaum chapter 1,2,3,4 notes Distributed system Tanenbaum chapter 1,2,3,4 notes
Distributed system Tanenbaum chapter 1,2,3,4 notes
 
Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess Communication
 
Unit 1 architecture of distributed systems
Unit 1 architecture of distributed systemsUnit 1 architecture of distributed systems
Unit 1 architecture of distributed systems
 
Security in distributed systems
Security in distributed systems Security in distributed systems
Security in distributed systems
 
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESDISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
 
Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
 
Fault Tolerance System
Fault Tolerance SystemFault Tolerance System
Fault Tolerance System
 
Chapter 6 synchronization
Chapter 6 synchronizationChapter 6 synchronization
Chapter 6 synchronization
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systems
 
Distributed shred memory architecture
Distributed shred memory architectureDistributed shred memory architecture
Distributed shred memory architecture
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memory
 
Advanced computer architecture
Advanced computer architectureAdvanced computer architecture
Advanced computer architecture
 
8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems8. mutual exclusion in Distributed Operating Systems
8. mutual exclusion in Distributed Operating Systems
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
 
Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]Chorus - Distributed Operating System [ case study ]
Chorus - Distributed Operating System [ case study ]
 
Message and Stream Oriented Communication
Message and Stream Oriented CommunicationMessage and Stream Oriented Communication
Message and Stream Oriented Communication
 
Communication in Distributed Systems
Communication in Distributed SystemsCommunication in Distributed Systems
Communication in Distributed Systems
 
11 distributed file_systems
11 distributed file_systems11 distributed file_systems
11 distributed file_systems
 
Distributed deadlock
Distributed deadlockDistributed deadlock
Distributed deadlock
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system model
 

Ähnlich wie dos mutual exclusion algos

Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systems
guest61205606
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systems
guest61205606
 
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
 
Operating-System-(1-3 group) Case study on windows Mac and linux among variou...
Operating-System-(1-3 group) Case study on windows Mac and linux among variou...Operating-System-(1-3 group) Case study on windows Mac and linux among variou...
Operating-System-(1-3 group) Case study on windows Mac and linux among variou...
ssuser4a97d3
 

Ähnlich wie dos mutual exclusion algos (20)

Critical Section in Operating System
Critical Section in Operating SystemCritical Section in Operating System
Critical Section in Operating System
 
critical section problem.pptx
critical section problem.pptxcritical section problem.pptx
critical section problem.pptx
 
Operating system 27 semaphores
Operating system 27 semaphoresOperating system 27 semaphores
Operating system 27 semaphores
 
Chapter05 new
Chapter05 newChapter05 new
Chapter05 new
 
Operating System- INTERPROCESS COMMUNICATION.docx
Operating System- INTERPROCESS COMMUNICATION.docxOperating System- INTERPROCESS COMMUNICATION.docx
Operating System- INTERPROCESS COMMUNICATION.docx
 
Distributed systems and scalability rules
Distributed systems and scalability rulesDistributed systems and scalability rules
Distributed systems and scalability rules
 
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
 
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 ...
 
Design space for user interface architectures
Design space for user interface architecturesDesign space for user interface architectures
Design space for user interface architectures
 
FAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDS
FAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDSFAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDS
FAULT TOLERANCE OF RESOURCES IN COMPUTATIONAL GRIDS
 
Review of Some Checkpointing Schemes for Distributed and Mobile Computing Env...
Review of Some Checkpointing Schemes for Distributed and Mobile Computing Env...Review of Some Checkpointing Schemes for Distributed and Mobile Computing Env...
Review of Some Checkpointing Schemes for Distributed and Mobile Computing Env...
 
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...
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronization
 
Distributed system
Distributed systemDistributed system
Distributed system
 
Operating-System-(1-3 group) Case study on windows Mac and linux among variou...
Operating-System-(1-3 group) Case study on windows Mac and linux among variou...Operating-System-(1-3 group) Case study on windows Mac and linux among variou...
Operating-System-(1-3 group) Case study on windows Mac and linux among variou...
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronization
 
Lecture 9 - Process Synchronization.pptx
Lecture 9 - Process Synchronization.pptxLecture 9 - Process Synchronization.pptx
Lecture 9 - Process Synchronization.pptx
 
Dos unit3
Dos unit3Dos unit3
Dos unit3
 

Kürzlich hochgeladen

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 

dos mutual exclusion algos

  • 1. Distributed Mutual Exclusion • Synchronization in Distributed Systems Synchronization in distributed systems are often more difficult compared to synchronization in uniprocessor and multiprocessor systems.
  • 2. Synchronization in Distributed Systems  Synchronization in time – achieved by Clock Synchronization algorithms  Synchronization between resources - Mutual Exclusion algorithms  Synchronization in activities - Distributed Transaction paradigms
  • 3. Distributed Mutual Exclusion  Mutual Exclusion Mutual exclusion (often abbreviated to mutex) algorithms are used in concurrent programming to avoid the simultaneous use of a common resource, such as a global variable, by pieces of computer code called critical sections.
  • 4. Distributed Mutual Exclusion  Critical Sections In concurrent programming a critical section is a piece of code that accesses a shared resource (data structure or device) that must not be concurrently accessed by more than one thread of execution. A critical section will usually terminate in fixed time, and a thread, task or process will only have to wait a fixed time to enter it. Some synchronization mechanism is required at the entry and exit of the critical section to ensure exclusive use, for example a semaphore.
  • 5. Distributed Mutual Exclusion  Achieving Mutual exclusion  Hardware solutions - Disabling interrupts on entry into the critical section  System variables - By using semaphores implemented as Locks  Software solutions - Mutual Exclusion Algorithms
  • 6. Distributed Mutual Exclusion  Mutual Exclusion Algorithms  Centralized algorithms  Distributed algorithms  Token ring algorithm
  • 7. Mutual Exclusion – centralized Algorithm a) Process 1 asks the coordinator for permission to enter a critical region. Permission is granted b) Process 2 then asks permission to enter the same critical region. The coordinator does not reply. c) When process 1 exits the critical region, it tells the coordinator, when then replies to 2
  • 8. Centralized Algorithm – Advantages Vs Disadvantages  Advantages  Fair algorithm, grants in the order of requests  The scheme is easy to implement  Scheme can be used for general resource allocation  Shortcomings  Single point of failure. No fault tolerance  Confusion between No-reply and permission denied  Performance bottleneck of single co-ordinator in a large system
  • 9. Mutual Exclusion – Distributed Algorithm a) Two processes want to enter the same critical region at the same moment. b) Process 0 has the lowest timestamp, so it wins. c) When process 0 is done, it sends an OK also, so 2 can now enter the critical region.
  • 10. Distributed Algorithm – Advantages Vs Disadvantages  Advantages  Single point of failure is overcome by keeping the system running even if one processes fail  No bottleneck on one process  Shortcomings  2(n-1) messages or more than that  Waiting for n-1 processes to accept is overkill  Improvements  Group membership for easy communication
  • 11. A Token Ring Algorithm a) An unordered group of processes on a network. b) A logical ring constructed in software.
  • 12. Token Ring Algorithm – Advantages Vs Disadvantages  Advantages  No co-ordinator and does not depend on other processes  On Crash token is just passed on to the neighbour  Shortcomings  Only a physical Q, no logical Q  Loss of token – Regeneration of tokens  Difficulty in finding the token crash – The processor might be alive
  • 13. Comparison  A comparison of three mutual exclusion algorithms. Algorithm Messages per entry/exit Delay before entry (in message times) Problems Centralized 3 2 Coordinator crash Distributed 2 ( n – 1 ) 2 ( n – 1 ) Overkill in waiting Token ring 1 to 0 to n – 1 Lost token on process crash
  • 14. References  Distributed systems – Principles and Paradigms – Andrew S Tanenbaum  A Survey of Mutual-Exclusion Algorithms for Multiprocessor Operating Systems http://www.teamten.com/lawrence/242.paper/242.paper.html