[erlang-questions] Global lock is unfair?

Ryan Stewart zzantozz@REDACTED
Tue May 15 20:13:20 CEST 2018


Dan, thanks for the mnesia hint. It looks like a murky pool to dive into,
but I'll read into it more.

On Tue, May 15, 2018 at 12:52 PM Ryan Stewart <zzantozz@REDACTED> wrote:

> Thanks for the pointer, Andrew. The process per resource would work, but
> how would you ensure that only one process is started per resource? The
> only way I know would be to write a central "manager" process that keeps
> track of the resource processes and directs traffic according to the
> resource "key", ensuring a new process is started when a new resource comes
> in demand. On top of that, the manager has to be aware of other nodes in
> the cluster and resource processes that might already exist elsewhere
> That's still a lot more work than seems necessary.
>
> On Tue, May 15, 2018 at 10:53 AM Andrew Thompson <
> andrew@REDACTED> wrote:
>
>> On Mon, May 14, 2018 at 04:53:08PM -0500, Ryan Stewart wrote:
>> > 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.
>> >
>>
>> For simple cases, wrapping a process around the individual resource and
>> using it as a lock is actually fine and should scale well. If you want
>> something fancier, there's Ulf's library:
>> https://github.com/uwiger/locks
>>
>> Andrew
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180515/c86f86bd/attachment.htm>


More information about the erlang-questions mailing list