[erlang-questions] Global lock is unfair?

Ryan Stewart zzantozz@REDACTED
Mon May 14 23:53:08 CEST 2018


Funneling all the calls through a single process would bring the system to
a grinding halt. Sure, I could write a system of processes, each of which
acts as a mutex to one, particular resource, but why would I want to? All I
need is locking, just like global locks, but fair. It seems like something
that should already exist in a proven library.

On Mon, May 14, 2018 at 3:41 PM Michael Truog <mjtruog@REDACTED> wrote:

> Use a single Erlang process.  It will only be able to handle a single
> message at a time (other messages will get queued in-order) and the
> behavior will be fair.
>
> On 05/14/2018 12:55 PM, Ryan Stewart wrote:
>
> My team has used global:set_lock() to implement a sort of simple mutex
> system on a set of resources. It turns out that this function seems to have
> no concept of fairness. One process might request a lock and not get it
> until 20 other processes have requested and gotten said lock, out of
> request order. Is there any easy way to do fair locking?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180514/c4c652fe/attachment.htm>


More information about the erlang-questions mailing list