In Distributed systems, such exclusive access to resources is called Distributed Mutual Exclusion, and such mutually exclusive access to shared resources is called Critical resources.

So how to achieve mutually exclusive access to critical resources in distributed systems?

Centralized algorithm

A coordinator program is introduced to obtain a distributed mutex algorithm.

Each program sends a request to the coordinator when it needs access to a critical resource. If no program is currently using the resource, the coordinator directly grants the requester access; Otherwise, requesters are “numbered” in first-come-first-served order. If an application runs out of resources, it notifies the coordinator, who takes the first request from the “numbered” queue and sends it an authorization message. Programs that receive authorization messages can directly access critical resources.


  • The coordinator becomes a performance bottleneck for the system.
  • Easy to cause single point of failure.

Distributed algorithm

When a program wants to access a critical resource, it first sends a request message to other programs in the system, and only after receiving the approval message from all programs can access the critical resource. The request message needs to contain the requested resource, the ID of the requester, and the time when the request was made. In the distributed world, we call them distributed algorithms, or algorithms that use multicast and logical clocks.

Token ring algorithm

All programs form a ring structure, and the token is passed between programs in a clockwise (or counterclockwise) direction. The program receiving the token has the right to access the critical resource, and when the access is complete, the token is transferred to the next program. If the program does not need access to a critical resource, the token is passed directly to the next program.

In the distributed world, this algorithm is called a token-ring algorithm, or a ring-based algorithm.

Notes from: Principles and Algorithms of Distributed Technology