SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed SystemSunita Sahu
 
CS8792 - Cryptography and Network Security
CS8792 - Cryptography and Network SecurityCS8792 - Cryptography and Network Security
CS8792 - Cryptography and Network Securityvishnukp34
 
CS9222 Advanced Operating System
CS9222 Advanced Operating SystemCS9222 Advanced Operating System
CS9222 Advanced Operating SystemKathirvel Ayyaswamy
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communicationAbDul ThaYyal
 
Distributed file system
Distributed file systemDistributed file system
Distributed file systemAnamika Singh
 
fault-tolerance-slide.ppt
fault-tolerance-slide.pptfault-tolerance-slide.ppt
fault-tolerance-slide.pptShailendra61
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency ControlDilum Bandara
 
Deadlock management
Deadlock managementDeadlock management
Deadlock managementAhmed kasim
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure callSunita Sahu
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
Distributed document based system
Distributed document based systemDistributed document based system
Distributed document based systemChetan Selukar
 
Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Ra'Fat Al-Msie'deen
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating systemudaya khanal
 

Tendances (20)

Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
 
CS8792 - Cryptography and Network Security
CS8792 - Cryptography and Network SecurityCS8792 - Cryptography and Network Security
CS8792 - Cryptography and Network Security
 
CS9222 Advanced Operating System
CS9222 Advanced Operating SystemCS9222 Advanced Operating System
CS9222 Advanced Operating System
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communication
 
Distributed file system
Distributed file systemDistributed file system
Distributed file system
 
fault-tolerance-slide.ppt
fault-tolerance-slide.pptfault-tolerance-slide.ppt
fault-tolerance-slide.ppt
 
Distributed deadlock
Distributed deadlockDistributed deadlock
Distributed deadlock
 
Transactions and Concurrency Control
Transactions and Concurrency ControlTransactions and Concurrency Control
Transactions and Concurrency Control
 
Deadlock management
Deadlock managementDeadlock management
Deadlock management
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
 
OS - Deadlock
OS - DeadlockOS - Deadlock
OS - Deadlock
 
Deadlock Avoidance in Operating System
Deadlock Avoidance in Operating SystemDeadlock Avoidance in Operating System
Deadlock Avoidance in Operating System
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
Distributed document based system
Distributed document based systemDistributed document based system
Distributed document based system
 
Mutual exclusion and sync
Mutual exclusion and syncMutual exclusion and sync
Mutual exclusion and sync
 
Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
 
Distributed System - Security
Distributed System - SecurityDistributed System - Security
Distributed System - Security
 

Similaire à dos mutual exclusion algos

Critical Section in Operating System
Critical Section in Operating SystemCritical Section in Operating System
Critical Section in Operating SystemChandnigupta80
 
critical section problem.pptx
critical section problem.pptxcritical section problem.pptx
critical section problem.pptxvtu19163
 
Operating system 27 semaphores
Operating system 27 semaphoresOperating system 27 semaphores
Operating system 27 semaphoresVaibhav Khanna
 
Operating System- INTERPROCESS COMMUNICATION.docx
Operating System- INTERPROCESS COMMUNICATION.docxOperating System- INTERPROCESS COMMUNICATION.docx
Operating System- INTERPROCESS COMMUNICATION.docxminaltmv
 
Distributed systems and scalability rules
Distributed systems and scalability rulesDistributed systems and scalability rules
Distributed systems and scalability rulesOleg Tsal-Tsalko
 
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
 
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
 
Design space for user interface architectures
Design space for user interface architecturesDesign space for user interface architectures
Design space for user interface architecturessnabifs
 
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 GRIDSMaurvi04
 
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...Eswar Publications
 
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
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronizationlodhran-hayat
 
Distributed system
Distributed systemDistributed system
Distributed systemchirag patil
 
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
 
Lecture 9 - Process Synchronization.pptx
Lecture 9 - Process Synchronization.pptxLecture 9 - Process Synchronization.pptx
Lecture 9 - Process Synchronization.pptxEhteshamulIslam1
 

Similaire à 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
 

Dernier

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 POSCeline George
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
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 FellowsMebane Rash
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
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...Poonam Aher Patil
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
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 PractiseAnaAcapella
 

Dernier (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
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
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
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
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...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
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
 

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