0% found this document useful (0 votes)
65 views

Suzuki-Kasami-Algorithm-and-Mutual-Exclusion-in-Distributed-Systems

Uploaded by

Ravi Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

Suzuki-Kasami-Algorithm-and-Mutual-Exclusion-in-Distributed-Systems

Uploaded by

Ravi Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Suzuki-Kasami

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.

2 Independent Failure of Nodes


Processes can fail independently, requiring fault-tolerant
mechanisms.

3 Communication Delays
Messages can be delayed or lost, impacting
synchronization and consistency.
preencoded.png
Handling Mutual Exclusion in Distributed
Algorithms

Message Passing Synchronization Safety, Liveness, and Fairness


Processes communicate using Algorithms ensure consistent Properties that guarantee correct
messages to coordinate access. access to shared resources. behavior and equitable access.

preencoded.png
Types of Distributed
Mutual Exclusion
Algorithms
Centralized Algorithm Simple, but vulnerable to single
point of failure.

Token-based Algorithm Processes pass a token to gain


access, ensuring mutual
exclusion.

Quorum-based Algorithm Processes vote to acquire access,


requiring a majority vote.

Timestamp-based Algorithm Processes use timestamps to


determine access order.

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

• Efficient use of messages • Network failures and token loss


• Scalability in large distributed systems • Handling new or departing nodes in the system
• Fairness in granting access to the critical section • Comparison with other algorithms in terms of complexity and overhead
preencoded.png
Working of Suzuki-Kasami
Algorithm
1 Initial Setup

A token is created and assigned to one process.

2 Requesting the Critical Section

A process sends a request message to all other


processes.

3 Passing the Token

The token is passed to the next process in the


request queue.

4 Entering and Exiting the Critical Section

The process holding the token enters the critical


section and releases it upon completion.
preencoded.png
1. System Model:
o The system consists of N processes, P1, P2, ..., PN.
o Each process is assigned a unique ID.
2. Token:
o A unique token is used to grant permission to enter the critical section.
o Only one process can hold the token at any given time.
Token Queue (Q):
o A queue that contains the IDs of processes waiting for the token.
Token Array (LN[1...N]):
LN[i] stores the sequence number of the last executed request by process Pi.
Suzuki-Kasami
o

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

You might also like