Suzuki-Kasami-Algorithm-and-Mutual-Exclusion-in-Distributed-Systems
Suzuki-Kasami-Algorithm-and-Mutual-Exclusion-in-Distributed-Systems
Algorithm and
Mutual Exclusion in
Distributed Systems
This presentation explores the Suzuki-Kasami algorithm, a token-
based approach to mutual exclusion in distributed systems. We'll
delve into the concept of critical sections, the challenges of
distributed systems, and the advantages of this algorithm.
Mr. R. Arunkumar
AP-CSE
preencoded.png
The Concept of Critical Section
When more than one processes try to access the same code segment that segment is known as
the critical section. The critical section contains shared variables or resources that need to be
synchronized to maintain the consistency of data variables.
preencoded.png
Example:
Shared Resource: The bank account balance.
Processes: Two processes, Process A and Process B, are trying to update the balance.
Let's say the initial balance is $1000.
• Process A: Wants to withdraw $200.
• Process B: Wants to deposit $300.
Without mutual exclusion, the following sequence might occur:
1. Process A: Reads the balance (initially $1000).
2. Process B: Reads the balance (still $1000, as A hasn’t updated it yet).
3. Process A: Subtracts $200, getting $800.
4. Process B: Adds $300, getting $1300.
5. Process A: Writes $800 back to the balance.
6. Process B: Writes $1300 back to the balance.
Final balance: $1300 (which is incorrect).
Expected Final Balance: $1100 (since $1000 - $200 + $300 = $1100).
preencoded.png
Critical Section Solution:
To avoid this inconsistency, the operations involving reading and writing the balance must be done within a
critical section.
Correct Sequence with a Critical Section:
1. Process A enters the critical section:
o Reads the balance: $1000.
o Subtracts $200: $800.
o Writes $800 back to the balance.
o Exits the critical section.
2. Process B enters the critical section:
o Reads the updated balance: $800.
o Adds $300: $1100.
o Writes $1100 back to the balance.
o Exits the critical section.
Final balance: $1100 (which is correct).
preencoded.png
Methods Handling Critical
Sections
Single Coordinator
Centralized locking mechanism, susceptible to single point of failure.
Token-Based Algorithms
Processes pass a token to gain access to the critical section.
Quorum-Based Algorithms
Processes vote to acquire access, requiring a majority vote.
Timestamp-Based Algorithms
Processes use timestamps to determine access order.
preencoded.png
Challenges in
Distributed Systems
1 Lack of Global Clock
Processes have independent clocks, making it difficult to
synchronize events.
3 Communication Delays
Messages can be delayed or lost, impacting
synchronization and consistency.
preencoded.png
Handling Mutual Exclusion in Distributed
Algorithms
preencoded.png
Types of Distributed
Mutual Exclusion
Algorithms
Centralized Algorithm Simple, but vulnerable to single
point of failure.
preencoded.png
Introduction to the Suzuki-Kasami
Algorithm
The Suzuki-Kasami algorithm is a token-based approach to mutual exclusion in distributed systems. It utilizes
a token-passing mechanism to grant access to the critical section, ensuring fairness and efficiency.
Pro’s Con’s
3. Request Queue:
Algorithm o
o
Each process maintains a request queue to store requests for the token.
The queue keeps track of which processes have requested the token.
Request Number Array (RN[1...N]):
o RN[i] stores the highest numbered request from process Pi that has been
received by the current process.
preencoded.png
preencoded.png
preencoded.png
preencoded.png
preencoded.png
preencoded.png
preencoded.png
Summary
❑ The Suzuki-Kasami algorithm effectively ensures mutual exclusion in distributed
systems using a token-based approach.
❑ It is efficient in message handling and scalable for large systems, making it suitable
for environments with multiple processes.
❑ The algorithm guarantees fairness by allowing processes to access the critical
section in the order of their requests.
❑ Token management is crucial, especially in handling network failures or lost
tokens, to maintain system reliability.
❑ Overall, the Suzuki-Kasami algorithm is a robust and reliable solution for
achieving mutual exclusion in distributed computing.
preencoded.png