Dlock is a server for distributed locking for process synchronization & exclusive transactions in distributed systems.
Generally, a distributed lock can be used to coordinate access to a resource or interest in
such a resource in a distributed environment. In other words, distributed locks are useful when multiple systems need to reach a consensus about a shared resource.
Lock Modes
As apposed to standard single-host locking mechanisms, distributed locks can be categorized into distinct modes with varying degress of distributed access guarantees.
Null (NL) : indicates interest in the resource, but does not prevent other process from locking it
Concurrent Read (CR) : Indicates a desire to read (but not update) the resources. Allows other processes to read or update the resource but prevents exclusive access to it.
Concurrent Write (CW) : Indicates a desire to read and update the resource. It allows other processes to read or update the resource, but prevents others from having EX access to it.
Protected Read (PR) : Traditional share lock, which indicates a desire to read the resource but prevents others from updating it. Others can however also read the resource.
Protected Write (PW) : Traditional update lock, indicates a desire to read and update the resource and prevents others from updating it. Others with Concurrent read access can however read the resource
Exclusive (EX) : Traditional exclusive lock, which allows read and update access to the resource, and prevents others from having access to it.
Mode
NL
CR
CW
PR
PW
EX
NL
:white_check_mark:
:white_check_mark:
:white_check_mark:
:white_check_mark:
:white_check_mark:
:white_check_mark:
CR
:white_check_mark:
:white_check_mark:
:white_check_mark:
:white_check_mark:
:white_check_mark:
:x:
CW
:white_check_mark:
:white_check_mark:
:white_check_mark:
:x:
:x:
:x:
PR
:white_check_mark:
:white_check_mark:
:x:
:white_check_mark:
:x:
:x:
PW
:white_check_mark:
:white_check_mark:
:x:
:x:
:x:
:x:
EX
:white_check_mark:
:x:
:x:
:x:
:x:
:x:
Notes
A typical mutex corresponds one-to-one with a distributed exclusive lock (EX).
There is no one-to-one mapping for a RW mutex in a distributed setting, although Protected Read & Write locks correspond closely to many of a RW mutexe's guarantees
**Note:** It is recommended to use the server binary for production environments, as it is guaranteed to handle synchronization edge cases that may not be fully addressed when using the plain SDK.
**Note:** It is recommended to use the server binary for production environments, as it is guaranteed to handle synchronization edge cases that may not be fully addressed when using the plain SDK.