[erlang-questions] Does read-write lock has a better performance than actor model?

Bin Wang wbin00@REDACTED
Tue Apr 15 15:46:09 CEST 2014


I meas if there is a write, then give it a lock. If all the requests are
read operations, then no lock is needed. That means multiple read
operations could be doing at the same time while there is no write
operations.

However, in actor model, the requests are always handled one by one no
matter they are reads or writes. So didn't it slow at some situations?
(Read are more that write).

---
Bin Wang


2014-04-15 21:37 GMT+08:00 Dmitry Kolesnikov <dmitry@REDACTED>:

> Hello,
>
> No, this is not good.
>
> Any on-going “write request” makes changes to the state. The read request
> does not know when the state becomes consistent unless there is a lock on
> the state. You cannot ensure safe reading while writes is going on.
> Therefore, actor model has bigger advantage.
>
> - Dmitry
>
> On 15 Apr 2014, at 16:31, Bin Wang <wbin00@REDACTED> wrote:
>
> > In Erlang, we handle concurrency in such a way: a process receives
> messages in its mailbox. And handle them one by one, just one in the same
> time.
> >
> > But in some situation, the request just want to read the resource. So
> the read requests should be able to execute at the same time since they
> don't change or break anything.
> >
> > So dose this meas if we use a write lock in such situation, we will have
> a better performance? If so, does Erlang have a proper way to do that?
> >
> > Thanks.
> >
> > ---
> > Bin Wang
> > _______________________________________________
> > 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/20140415/558f1b22/attachment.htm>


More information about the erlang-questions mailing list