DISTRIBUTED SYSTEM
CHAPTER 10 : CASE STUDY
LAB WORK SOLUTION- DISTRIBUTED SYSTEM
DISTRIBUTED SYSTEM -BCA -ALL SLIDES
MCQ- DISTRIBUTED SYSTEM

DISTRIBUTED SYSTEM NOTES,IOE,TU,BCA

ALGORITHM FOR MUTUAL EXCLUSION

1. Lamport's Algorithm

  • Idea: Uses logical clocks to order requests for the critical section.
  • Mechanism:
    1. When a process wants to enter the critical section, it sends a timestamped request to all other processes.
    2. Each process maintains a request queue ordered by timestamps.
    3. A process can enter the critical section when its request is at the head of the queue and it has received replies from all other processes.
    4. After exiting the critical section, it sends a release message to all processes to remove its request from their queues.

2. Ricart-Agrawala Algorithm

  • Idea: A more efficient algorithm than Lamport's, reducing the number of messages needed.
  • Mechanism:
    1. A process sends a timestamped request message to all other processes.
    2. Other processes reply with a grant message if they are not interested in the critical section or if the requesting process has a higher priority (based on timestamp).
    3. The process can enter the critical section after receiving a reply from all processes.
    4. Upon exiting, it sends a release message to all processes.

3. Token Ring Algorithm

  • Idea: Uses a token that circulates among processes. The process holding the token can enter the critical section.
  • Mechanism:
    1. Processes are arranged in a logical ring.
    2. The token is passed around the ring. When a process receives the token, it can enter the critical section.
    3. After exiting the critical section, it passes the token to the next process in the ring.
  • Advantage: Simplicity and fewer messages as only the token is passed.

4. Maekawa's Algorithm

  • Idea: Reduces the number of messages by using a voting mechanism among a subset of processes.
  • Mechanism:
    1. Each process is associated with a unique set of other processes (voting set).
    2. To enter the critical section, a process must receive permission from all processes in its voting set.
    3. A process grants permission if it is not in the critical section and has not granted permission to another process.
    4. Upon exiting, it sends a release message to its voting set.