SlideShare a Scribd company logo
1 of 38
Mutual Exclusion in Distributed
Systems
Name : Ajay Kharat
ID : 2019H1030011P
BITS-Pilani
Mutual Exclusion Algorithms for
Distributed Systems
•Classification
•Non Token Based
•Lamport’s
•Ricart Agrawala’s
•Maekawa’s
•Token Based
•Suzuki Kasami’s Broadcast
•Singhal’s Heuristics
•Raymond’s Tree Based
System
SV [1…..N] : System State
SN [1…..N] : Highest Seq. No.
Token
TSV [1…..N] : System State
TSN [1…..N] : Highest Seq. No.
Singhal’s Heuristic Algorithm
S1
S2
S3
S4
SV [ H N N N ]
SN [ 0 0 0 0 ]
SV [ R N N N ]
SN [ 0 0 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N N N N ]
TSN [ 0 0 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S1
S2
S3
S4
SV [ H N N N ]
SN [ 0 0 0 0 ]
SV [ R R N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N N N N ]
TSN [ 0 0 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S2 is Requesting
Token
REQUEST Only “HRE”
S1
S2
S3
S4
SV [ H N N N ]
SN [ 0 0 0 0 ]
SV [ R R N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N N N N ]
TSN [ 0 0 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
RQ (2,1)
S2 sends Request to S1
S1
S2
S3
S4
SV [ H N N N ]
SN [ 0 0 0 0 ]
SV [ R R N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N N N N ]
TSN [ 0 0 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
RQ (2,1)
S1 updates itself and
Token(if reqd)
S1
S2
S3
S4
SV [ H N N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N N N N ]
TSN [ 0 0 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S1 updates itself and
Token(if reqd)
RQ (2,1)
State of System Receiving the Request
Requesting Mode R
Executing Mode E
Holding idle Token H
None of the Above N
Action
Accept the Request, Inform the
sender about its own status
Accept the Request
Accept the Request and update
the Token
Accept the Request
S1
S2
S3
S4
SV [ N R N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N R N N ]
TSN [ 0 1 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
Token Updated
S1
S2
S3
S4
SV [ N R N N ]
SN [ 0 1 0 0 ]
SV [ R E N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N R N N ]
TSN [ 0 1 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S1 completes CS
Sends Token to S2 S2 sets status to E and
Executes CS
S1
S2
S3
S4
SV [ N R N N ]
SN [ 0 1 0 0 ]
SV [ R N N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N N N N ]
TSN [ 0 1 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S2 comes out of CS
Sets status to N
Token
Updated
If System has latest information Update the
Token
Else update itself from
Token
Information : Sequence Nos. possessed by System and Token
if SN > TNS , System has latest information
S1
S2
S3
S4
SV [ N R N N ]
SN [ 0 1 0 0 ]
SV [ R N N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N N N N ]
TSN [ 0 1 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S2 updates itself
S1
S2
S3
S4
SV [ N R N N ]
SN [ 0 1 0 0 ]
SV [ N N N N ]
SN [ 0 1 0 0 ]
SV [ R R N N ]
SN [ 0 0 0 0 ]
SV [ R R R N ]
SN [ 0 0 0 0 ]
TSV [ N N N N ]
TSN [ 0 1 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S2 updates itself
S1
S2
S3
S4
SV [ N H N N ]
SN [ 0 1 0 0 ]
SV [ N H N N ]
SN [ 0 1 0 0 ]
SV [ N H N N ]
SN [ 0 1 0 0 ]
SV [ N H N N ]
SN [ 0 1 0 0 ]
TSV [ N N N N ]
TSN [ 0 1 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S2 sets its status to H
All systems are updated
S1
S2
S3
S4
SV [ N H N N ]
SN [ 0 1 0 0 ]
SV [ N H N N ]
SN [ 0 1 0 0 ]
SV [ N H R N ]
SN [ 0 1 1 0 ]
SV [ N H N N ]
SN [ 0 1 0 0 ]
TSV [ N N N N ]
TSN [ 0 1 0 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
Contd.. S3 makes a REQUEST
REQUEST Only “HRE”
R(3,1)
S1
S2
S3
S4
SV [ N H N N ]
SN [ 0 1 0 0 ]
SV [ N H R N ]
SN [ 0 1 1 0 ]
SV [ N H R N ]
SN [ 0 1 1 0 ]
SV [ N H N N ]
SN [ 0 1 0 0 ]
TSV [ N N R N ]
TSN [ 0 1 1 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S2 sets S3’s status to R
S2 then updates the TOKEN for S3
S1
S2
S3
S4
SV [ N H N N ]
SN [ 0 1 0 0 ]
SV [ N N R N ]
SN [ 0 1 1 0 ]
SV [ N N E N ]
SN [ 0 1 1 0 ]
SV [ N H N N ]
SN [ 0 1 0 0 ]
TSV [ N N R N ]
TSN [ 0 1 1 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S2 sets its own status to N
Sends TOKEN to S3
S3 sets status to E
Executes CS
S1
S2
S3
S4
SV [ N H N N ]
SN [ 0 1 0 0 ]
SV [ N N R N ]
SN [ 0 1 1 0 ]
SV [ N H N N ]
SN [ 0 1 1 0 ]
SV [ N H N N ]
SN [ 0 1 0 0 ]
TSV [ N N R N ]
TSN [ 0 1 1 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S3 comes out of CS
Looks for any other ‘R’
S1
S2
S3
S4
SV [ N N H N ]
SN [ 0 1 1 0 ]
SV [ N N H N ]
SN [ 0 1 1 0 ]
SV [ N N H N ]
SN [ 0 1 1 0 ]
SV [ N N H N ]
SN [ 0 1 1 0 ]
TSV [ N N N N ]
TSN [ 0 1 1 0 ]
STATES
R : REQUESTING A TOKEN
H : HOLDING IDLE TOKEN
E : EXECUTING IN CRITICAL SECTION
N:NONE OF THE ABOVE
S2 sets its own status to H
All sites are then updated
DeadLock and Starvation
Request sent to only those
systems who possess the Token or
will get Token in near future : E, R,
or H
If RQ is sent to any other system
if ‘N’ systems send
requests to each other : Deadlock
if a system sends request
to N system : Starvation
S1
S2
SV [ H N N N ]
SN [ 0 1 0 0 ]
SV [ R N N N ]
SN [ 0 1 0 0 ]
S3
SV [ R N N N ]
SN [ 0 1 0 0 ]
Correctness and Performance
Is the Algorithm Correct ? Will it ensure Mutual Exclusion ? YES
Presence of Token is necessary for CS to be executed
Only 1 system possesses the Token
What is the Performance metric and measure of this Algorithm ?
Less message overhead. Only few selected systems are requested
for Token
Avg/Max Message Traffic : N/2 or N (N : No. of systems)
Synchronization Delay : T (Delay between two consecutive CS
executions)
Response Time : 2T + CS execution Time (E)
Token values can be Binary {0,1} representing {R or N}
Raymond’s Tree Based Algorithm
All the sites have a Holder variable (pointer) to their neighbors
(parent) eventually reaching the site possessing the token
6
2 3
4 5
1
7
TOKEN
QUEUE
SITES
Raymond’s Tree Based Algorithm
Site 4 requests the TOKEN. Sends REQUEST to Site 2
Both sites update their queues, eventually requesting TOKEN holder
6
2 3
4 5
1
7
TOKEN
4
R4
4
2
Raymond’s Tree Based Algorithm
TOKEN site serves the REQUEST of site 2
6
2 3
4 5
1
7
4
R4
4
Raymond’s Tree Based Algorithm
6
2 3
4 5
1
7
6 7
6 7 3
Site 2 sends TOKEN to requesting Site 4, 4 executes the CS
Site 6 and 7 also REQUEST for TOKEN
Raymond’s Tree Based Algorithm
Each site enroute to TOKEN Site update their entries and forward the
REQUESTs, eventually reaching TOKEN site
6
2 3
4 5
1
7
2 6 7
6 7 3
3
1
Raymond’s Tree Based Algorithm
TOKEN site serves the REQUESTs of sites and forward the TOKEN
6
2 3
4 5
1
7
6 7
6 7 3
3
1
Raymond’s Tree Based Algorithm
6
2 3
4 5
1
7
6 7
6 7 3
3
Raymond’s Tree Based Algorithm
The requesting site gets the TOKEN and executes CS
6
2 3
4 5
1
7
7
7 3
Raymond’s Tree Based Algorithm
Site 3 sends the REQUEST for Site 7 to TOKEN site
6
2 3
4 5
1
7
7
7 3
R3
3
Raymond’s Tree Based Algorithm
Site 6 sends the TOKEN to requesting site and updates its queue
6
2 3
4 5
1
7
7 3
7
Raymond’s Tree Based Algorithm
Site 3 sends the TOEKN to Site 7 which then executes CS
6
2 3
4 5
1
7
3
7
Raymond’s Tree Based Algorithm
Site 3 sends the REQUEST for itself to TOKEN site
6
2 3
4 5
1
7
3
R3
3
Raymond’s Tree Based Algorithm
TOKEN site sends the TOKEN to requesting site
ALL REQUESTs are now fulfilled
6
2 3
4 5
1
7
Correctness and Performance
Is the Algorithm Correct ? Will it ensure Mutual Exclusion ? YES
Presence of Token is necessary for CS to be executed
Only 1 system possesses the Token
Tree has no cycles 🡪 no Deadlock
Each site receives the Token 🡪 no Starvation
What is the Performance metric and measure of this Algorithm ?
Average message complexity : O(log N) (avg distance between 2
sites)
Synchronization Delay : (T log N ) /2 (T : avg message delay)
Site can execute CS when it gets the TOKEN even if it is not its turn
On heavy loads, Synchrinozation Delay : T
Response Time : T (log N) +E (time to execute CS)
That’s it..
Thank You

More Related Content

What's hot

Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
Eucalyptus, Nimbus & OpenNebula
Eucalyptus, Nimbus & OpenNebulaEucalyptus, Nimbus & OpenNebula
Eucalyptus, Nimbus & OpenNebulaAmar Myana
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed systemSunita Sahu
 
Market oriented Cloud Computing
Market oriented Cloud ComputingMarket oriented Cloud Computing
Market oriented Cloud ComputingJithin Parakka
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure callSunita Sahu
 
Implementation levels of virtualization
Implementation levels of virtualizationImplementation levels of virtualization
Implementation levels of virtualizationGokulnath S
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionSHIKHA GAUTAM
 
Message authentication
Message authenticationMessage authentication
Message authenticationCAS
 
Physical and Logical Clocks
Physical and Logical ClocksPhysical and Logical Clocks
Physical and Logical ClocksDilum Bandara
 
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 SystemsDr Sandeep Kumar Poonia
 
Multi processor scheduling
Multi  processor schedulingMulti  processor scheduling
Multi processor schedulingShashank Kapoor
 
Election algorithms
Election algorithmsElection algorithms
Election algorithmsAnkush Kumar
 
Communications is distributed systems
Communications is distributed systemsCommunications is distributed systems
Communications is distributed systemsSHATHAN
 
Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed SystemSunita Sahu
 

What's hot (20)

Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
Eucalyptus, Nimbus & OpenNebula
Eucalyptus, Nimbus & OpenNebulaEucalyptus, Nimbus & OpenNebula
Eucalyptus, Nimbus & OpenNebula
 
Ssl and tls
Ssl and tlsSsl and tls
Ssl and tls
 
And or graph
And or graphAnd or graph
And or graph
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed system
 
IP Security
IP SecurityIP Security
IP Security
 
Market oriented Cloud Computing
Market oriented Cloud ComputingMarket oriented Cloud Computing
Market oriented Cloud Computing
 
Resource management
Resource managementResource management
Resource management
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
 
Implementation levels of virtualization
Implementation levels of virtualizationImplementation levels of virtualization
Implementation levels of virtualization
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock Detection
 
Replication in Distributed Systems
Replication in Distributed SystemsReplication in Distributed Systems
Replication in Distributed Systems
 
Message authentication
Message authenticationMessage authentication
Message authentication
 
Physical and Logical Clocks
Physical and Logical ClocksPhysical and Logical Clocks
Physical and Logical Clocks
 
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
 
Multi processor scheduling
Multi  processor schedulingMulti  processor scheduling
Multi processor scheduling
 
Election algorithms
Election algorithmsElection algorithms
Election algorithms
 
MapReduce in Cloud Computing
MapReduce in Cloud ComputingMapReduce in Cloud Computing
MapReduce in Cloud Computing
 
Communications is distributed systems
Communications is distributed systemsCommunications is distributed systems
Communications is distributed systems
 
Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
 

More from AJAY KHARAT

Uncovering Bugs in P4 Programs with Assertion-based Verification
Uncovering Bugs in P4 Programs with Assertion-based VerificationUncovering Bugs in P4 Programs with Assertion-based Verification
Uncovering Bugs in P4 Programs with Assertion-based VerificationAJAY KHARAT
 
SDPROBER: A SOFTWARE DEFINED PROBER FOR SDN
SDPROBER: A SOFTWARE DEFINED PROBER FOR SDNSDPROBER: A SOFTWARE DEFINED PROBER FOR SDN
SDPROBER: A SOFTWARE DEFINED PROBER FOR SDNAJAY KHARAT
 
Instrumenting Open vSwitch with Monitoring Capabilities: Designs and Challenges
Instrumenting Open vSwitch with Monitoring Capabilities: Designs and ChallengesInstrumenting Open vSwitch with Monitoring Capabilities: Designs and Challenges
Instrumenting Open vSwitch with Monitoring Capabilities: Designs and ChallengesAJAY KHARAT
 
Memory and Performance Isolation for a Multi-tenant Function-based Data-plane
Memory and Performance Isolation for a Multi-tenant Function-based Data-planeMemory and Performance Isolation for a Multi-tenant Function-based Data-plane
Memory and Performance Isolation for a Multi-tenant Function-based Data-plane AJAY KHARAT
 
NS4: Enabling Programmable Data Plane Simulation
NS4: Enabling Programmable Data Plane SimulationNS4: Enabling Programmable Data Plane Simulation
NS4: Enabling Programmable Data Plane SimulationAJAY KHARAT
 
YATES: Rapid Prototyping for Traffic Engineering Systems
YATES: Rapid Prototyping forTraffic Engineering SystemsYATES: Rapid Prototyping forTraffic Engineering Systems
YATES: Rapid Prototyping for Traffic Engineering SystemsAJAY KHARAT
 
Life in the Fast Lane: A Line-Rate Linear Road
Life in the Fast Lane: A Line-Rate Linear RoadLife in the Fast Lane: A Line-Rate Linear Road
Life in the Fast Lane: A Line-Rate Linear RoadAJAY KHARAT
 
How to implement complex policies on existing network infrastructure
How to implement complex policies on existing network infrastructure How to implement complex policies on existing network infrastructure
How to implement complex policies on existing network infrastructure AJAY KHARAT
 
Network-Wide Heavy-Hitter Detection with Commodity Switches
Network-Wide Heavy-Hitter Detection with Commodity SwitchesNetwork-Wide Heavy-Hitter Detection with Commodity Switches
Network-Wide Heavy-Hitter Detection with Commodity SwitchesAJAY KHARAT
 
p4pktgen: Automated Test Case Generation for P4 Programs
p4pktgen:  Automated Test Case  Generation for P4 Programsp4pktgen:  Automated Test Case  Generation for P4 Programs
p4pktgen: Automated Test Case Generation for P4 ProgramsAJAY KHARAT
 
virtual memory management in multi processor mach os
virtual memory management in multi processor mach osvirtual memory management in multi processor mach os
virtual memory management in multi processor mach osAJAY KHARAT
 
Solutions to byzantine agreement problem
Solutions to byzantine agreement problem Solutions to byzantine agreement problem
Solutions to byzantine agreement problem AJAY KHARAT
 

More from AJAY KHARAT (12)

Uncovering Bugs in P4 Programs with Assertion-based Verification
Uncovering Bugs in P4 Programs with Assertion-based VerificationUncovering Bugs in P4 Programs with Assertion-based Verification
Uncovering Bugs in P4 Programs with Assertion-based Verification
 
SDPROBER: A SOFTWARE DEFINED PROBER FOR SDN
SDPROBER: A SOFTWARE DEFINED PROBER FOR SDNSDPROBER: A SOFTWARE DEFINED PROBER FOR SDN
SDPROBER: A SOFTWARE DEFINED PROBER FOR SDN
 
Instrumenting Open vSwitch with Monitoring Capabilities: Designs and Challenges
Instrumenting Open vSwitch with Monitoring Capabilities: Designs and ChallengesInstrumenting Open vSwitch with Monitoring Capabilities: Designs and Challenges
Instrumenting Open vSwitch with Monitoring Capabilities: Designs and Challenges
 
Memory and Performance Isolation for a Multi-tenant Function-based Data-plane
Memory and Performance Isolation for a Multi-tenant Function-based Data-planeMemory and Performance Isolation for a Multi-tenant Function-based Data-plane
Memory and Performance Isolation for a Multi-tenant Function-based Data-plane
 
NS4: Enabling Programmable Data Plane Simulation
NS4: Enabling Programmable Data Plane SimulationNS4: Enabling Programmable Data Plane Simulation
NS4: Enabling Programmable Data Plane Simulation
 
YATES: Rapid Prototyping for Traffic Engineering Systems
YATES: Rapid Prototyping forTraffic Engineering SystemsYATES: Rapid Prototyping forTraffic Engineering Systems
YATES: Rapid Prototyping for Traffic Engineering Systems
 
Life in the Fast Lane: A Line-Rate Linear Road
Life in the Fast Lane: A Line-Rate Linear RoadLife in the Fast Lane: A Line-Rate Linear Road
Life in the Fast Lane: A Line-Rate Linear Road
 
How to implement complex policies on existing network infrastructure
How to implement complex policies on existing network infrastructure How to implement complex policies on existing network infrastructure
How to implement complex policies on existing network infrastructure
 
Network-Wide Heavy-Hitter Detection with Commodity Switches
Network-Wide Heavy-Hitter Detection with Commodity SwitchesNetwork-Wide Heavy-Hitter Detection with Commodity Switches
Network-Wide Heavy-Hitter Detection with Commodity Switches
 
p4pktgen: Automated Test Case Generation for P4 Programs
p4pktgen:  Automated Test Case  Generation for P4 Programsp4pktgen:  Automated Test Case  Generation for P4 Programs
p4pktgen: Automated Test Case Generation for P4 Programs
 
virtual memory management in multi processor mach os
virtual memory management in multi processor mach osvirtual memory management in multi processor mach os
virtual memory management in multi processor mach os
 
Solutions to byzantine agreement problem
Solutions to byzantine agreement problem Solutions to byzantine agreement problem
Solutions to byzantine agreement problem
 

Recently uploaded

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 

Recently uploaded (20)

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 

Mutual exclusion in distributed systems

  • 1. Mutual Exclusion in Distributed Systems Name : Ajay Kharat ID : 2019H1030011P BITS-Pilani
  • 2. Mutual Exclusion Algorithms for Distributed Systems •Classification •Non Token Based •Lamport’s •Ricart Agrawala’s •Maekawa’s •Token Based •Suzuki Kasami’s Broadcast •Singhal’s Heuristics •Raymond’s Tree Based
  • 3. System SV [1…..N] : System State SN [1…..N] : Highest Seq. No. Token TSV [1…..N] : System State TSN [1…..N] : Highest Seq. No. Singhal’s Heuristic Algorithm
  • 4. S1 S2 S3 S4 SV [ H N N N ] SN [ 0 0 0 0 ] SV [ R N N N ] SN [ 0 0 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N N N N ] TSN [ 0 0 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE
  • 5. S1 S2 S3 S4 SV [ H N N N ] SN [ 0 0 0 0 ] SV [ R R N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N N N N ] TSN [ 0 0 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S2 is Requesting Token REQUEST Only “HRE”
  • 6. S1 S2 S3 S4 SV [ H N N N ] SN [ 0 0 0 0 ] SV [ R R N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N N N N ] TSN [ 0 0 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE RQ (2,1) S2 sends Request to S1
  • 7. S1 S2 S3 S4 SV [ H N N N ] SN [ 0 0 0 0 ] SV [ R R N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N N N N ] TSN [ 0 0 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE RQ (2,1) S1 updates itself and Token(if reqd)
  • 8. S1 S2 S3 S4 SV [ H N N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N N N N ] TSN [ 0 0 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S1 updates itself and Token(if reqd) RQ (2,1)
  • 9. State of System Receiving the Request Requesting Mode R Executing Mode E Holding idle Token H None of the Above N Action Accept the Request, Inform the sender about its own status Accept the Request Accept the Request and update the Token Accept the Request
  • 10. S1 S2 S3 S4 SV [ N R N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N R N N ] TSN [ 0 1 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE Token Updated
  • 11. S1 S2 S3 S4 SV [ N R N N ] SN [ 0 1 0 0 ] SV [ R E N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N R N N ] TSN [ 0 1 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S1 completes CS Sends Token to S2 S2 sets status to E and Executes CS
  • 12. S1 S2 S3 S4 SV [ N R N N ] SN [ 0 1 0 0 ] SV [ R N N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N N N N ] TSN [ 0 1 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S2 comes out of CS Sets status to N Token Updated
  • 13. If System has latest information Update the Token Else update itself from Token Information : Sequence Nos. possessed by System and Token if SN > TNS , System has latest information
  • 14. S1 S2 S3 S4 SV [ N R N N ] SN [ 0 1 0 0 ] SV [ R N N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N N N N ] TSN [ 0 1 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S2 updates itself
  • 15. S1 S2 S3 S4 SV [ N R N N ] SN [ 0 1 0 0 ] SV [ N N N N ] SN [ 0 1 0 0 ] SV [ R R N N ] SN [ 0 0 0 0 ] SV [ R R R N ] SN [ 0 0 0 0 ] TSV [ N N N N ] TSN [ 0 1 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S2 updates itself
  • 16. S1 S2 S3 S4 SV [ N H N N ] SN [ 0 1 0 0 ] SV [ N H N N ] SN [ 0 1 0 0 ] SV [ N H N N ] SN [ 0 1 0 0 ] SV [ N H N N ] SN [ 0 1 0 0 ] TSV [ N N N N ] TSN [ 0 1 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S2 sets its status to H All systems are updated
  • 17. S1 S2 S3 S4 SV [ N H N N ] SN [ 0 1 0 0 ] SV [ N H N N ] SN [ 0 1 0 0 ] SV [ N H R N ] SN [ 0 1 1 0 ] SV [ N H N N ] SN [ 0 1 0 0 ] TSV [ N N N N ] TSN [ 0 1 0 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE Contd.. S3 makes a REQUEST REQUEST Only “HRE” R(3,1)
  • 18. S1 S2 S3 S4 SV [ N H N N ] SN [ 0 1 0 0 ] SV [ N H R N ] SN [ 0 1 1 0 ] SV [ N H R N ] SN [ 0 1 1 0 ] SV [ N H N N ] SN [ 0 1 0 0 ] TSV [ N N R N ] TSN [ 0 1 1 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S2 sets S3’s status to R S2 then updates the TOKEN for S3
  • 19. S1 S2 S3 S4 SV [ N H N N ] SN [ 0 1 0 0 ] SV [ N N R N ] SN [ 0 1 1 0 ] SV [ N N E N ] SN [ 0 1 1 0 ] SV [ N H N N ] SN [ 0 1 0 0 ] TSV [ N N R N ] TSN [ 0 1 1 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S2 sets its own status to N Sends TOKEN to S3 S3 sets status to E Executes CS
  • 20. S1 S2 S3 S4 SV [ N H N N ] SN [ 0 1 0 0 ] SV [ N N R N ] SN [ 0 1 1 0 ] SV [ N H N N ] SN [ 0 1 1 0 ] SV [ N H N N ] SN [ 0 1 0 0 ] TSV [ N N R N ] TSN [ 0 1 1 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S3 comes out of CS Looks for any other ‘R’
  • 21. S1 S2 S3 S4 SV [ N N H N ] SN [ 0 1 1 0 ] SV [ N N H N ] SN [ 0 1 1 0 ] SV [ N N H N ] SN [ 0 1 1 0 ] SV [ N N H N ] SN [ 0 1 1 0 ] TSV [ N N N N ] TSN [ 0 1 1 0 ] STATES R : REQUESTING A TOKEN H : HOLDING IDLE TOKEN E : EXECUTING IN CRITICAL SECTION N:NONE OF THE ABOVE S2 sets its own status to H All sites are then updated
  • 22. DeadLock and Starvation Request sent to only those systems who possess the Token or will get Token in near future : E, R, or H If RQ is sent to any other system if ‘N’ systems send requests to each other : Deadlock if a system sends request to N system : Starvation S1 S2 SV [ H N N N ] SN [ 0 1 0 0 ] SV [ R N N N ] SN [ 0 1 0 0 ] S3 SV [ R N N N ] SN [ 0 1 0 0 ]
  • 23. Correctness and Performance Is the Algorithm Correct ? Will it ensure Mutual Exclusion ? YES Presence of Token is necessary for CS to be executed Only 1 system possesses the Token What is the Performance metric and measure of this Algorithm ? Less message overhead. Only few selected systems are requested for Token Avg/Max Message Traffic : N/2 or N (N : No. of systems) Synchronization Delay : T (Delay between two consecutive CS executions) Response Time : 2T + CS execution Time (E) Token values can be Binary {0,1} representing {R or N}
  • 24. Raymond’s Tree Based Algorithm All the sites have a Holder variable (pointer) to their neighbors (parent) eventually reaching the site possessing the token 6 2 3 4 5 1 7 TOKEN QUEUE SITES
  • 25. Raymond’s Tree Based Algorithm Site 4 requests the TOKEN. Sends REQUEST to Site 2 Both sites update their queues, eventually requesting TOKEN holder 6 2 3 4 5 1 7 TOKEN 4 R4 4 2
  • 26. Raymond’s Tree Based Algorithm TOKEN site serves the REQUEST of site 2 6 2 3 4 5 1 7 4 R4 4
  • 27. Raymond’s Tree Based Algorithm 6 2 3 4 5 1 7 6 7 6 7 3 Site 2 sends TOKEN to requesting Site 4, 4 executes the CS Site 6 and 7 also REQUEST for TOKEN
  • 28. Raymond’s Tree Based Algorithm Each site enroute to TOKEN Site update their entries and forward the REQUESTs, eventually reaching TOKEN site 6 2 3 4 5 1 7 2 6 7 6 7 3 3 1
  • 29. Raymond’s Tree Based Algorithm TOKEN site serves the REQUESTs of sites and forward the TOKEN 6 2 3 4 5 1 7 6 7 6 7 3 3 1
  • 30. Raymond’s Tree Based Algorithm 6 2 3 4 5 1 7 6 7 6 7 3 3
  • 31. Raymond’s Tree Based Algorithm The requesting site gets the TOKEN and executes CS 6 2 3 4 5 1 7 7 7 3
  • 32. Raymond’s Tree Based Algorithm Site 3 sends the REQUEST for Site 7 to TOKEN site 6 2 3 4 5 1 7 7 7 3 R3 3
  • 33. Raymond’s Tree Based Algorithm Site 6 sends the TOKEN to requesting site and updates its queue 6 2 3 4 5 1 7 7 3 7
  • 34. Raymond’s Tree Based Algorithm Site 3 sends the TOEKN to Site 7 which then executes CS 6 2 3 4 5 1 7 3 7
  • 35. Raymond’s Tree Based Algorithm Site 3 sends the REQUEST for itself to TOKEN site 6 2 3 4 5 1 7 3 R3 3
  • 36. Raymond’s Tree Based Algorithm TOKEN site sends the TOKEN to requesting site ALL REQUESTs are now fulfilled 6 2 3 4 5 1 7
  • 37. Correctness and Performance Is the Algorithm Correct ? Will it ensure Mutual Exclusion ? YES Presence of Token is necessary for CS to be executed Only 1 system possesses the Token Tree has no cycles 🡪 no Deadlock Each site receives the Token 🡪 no Starvation What is the Performance metric and measure of this Algorithm ? Average message complexity : O(log N) (avg distance between 2 sites) Synchronization Delay : (T log N ) /2 (T : avg message delay) Site can execute CS when it gets the TOKEN even if it is not its turn On heavy loads, Synchrinozation Delay : T Response Time : T (log N) +E (time to execute CS)