Q5Distributed System
Question
4 marks
Differentiate between centralized and distributed mutual exclusion algorithms.
Answer
A definitive comparison of Mutual Exclusion algorithms, contrasting the extreme speed and single-point-of-failure of Centralized servers against the massive message overhead and resilience of Distributed peer-to-peer protocols.
When multiple nodes must access a shared resource without corrupting data, the system must enforce a lock. The architectural approach to this locking mathematically dictates the scalability and reliability of the cluster.
1. Centralized Mutual Exclusion
The simplest, most primitive architecture.
- Mechanism: One specific node is mathematically elected as the supreme "Coordinator." All other nodes must blast a
REQUESTmessage over the network to the Coordinator. The Coordinator maintains a rigid queue. It sends aGRANTmessage to Node A. While Node A has the lock, if Node B requests it, the Coordinator remains silent (queuing Node B). When Node A finishes, it sends aRELEASEmessage, and the Coordinator grants Node B. - Merits: Blisteringly fast. It mathematically requires exactly 3 network messages to acquire and release a lock (Request, Grant, Release).
- Demerits: A catastrophic Single Point of Failure. If the Coordinator server violently loses power, the entire 10,000-node cluster instantly freezes in a permanent deadlock, unable to acquire locks.
2. Distributed Mutual Exclusion (e.g., Ricart-Agrawala)
A highly complex, peer-to-peer mathematical architecture with no central master.
- Mechanism: If Node A wants the lock, it must aggressively blast a
REQUESTmessage to EVERY SINGLE OTHER NODE in the entire cluster, attaching a Lamport timestamp. Node A must mathematically wait to receive an explicitOKreply from every single node. If Node B is currently holding the lock, Node B violently refuses to reply until it finishes. - Merits: No single point of failure. The cluster is highly resilient.
- Demerits: Horrific message complexity. In an -node system, acquiring a single lock mathematically requires messages. In a 1,000-node cluster, getting one lock generates 1,998 network packets, causing massive broadcast storms that can crash the network.