[erlang-questions] Mnesia and concurrency

Serge Aleynikov serge@REDACTED
Fri Dec 22 19:55:55 CET 2006


That is only if all reads are serialized through a server process.  As 
Hekan indicated, Mnesia (or ets) reads are not (e.g. look at 
mnesia:dirty_read/2, mnesia_lib:db_get/2).

Serge

Yariv Sadan wrote:
> How could one implement such a thing in Erlang? Assuming a table is
> owned by a single process, and that process can only accept one
> message at a time, how can multiple processes perform simultaneous
> reads on the table?
> 
> Yariv
> 
>> No, the same goes for Erlang and Mnesia. The difference
>> against other systems is that in Erlang we do not need
>> separate OS threads to achieve this. It suffices to use
>> separate Erlang processes (which may be hosted by any
>> connected Erlang node). Any number of Erlang processes
>> may read the same record without causing a locking
>> conflict. But if one Erlang process is grabbing a write
>> lock, it will get an exlusive lock for that record. The
>> same principle is also valid for table locks.
>>
>> /Hеkan
>>
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 

-- 
Serge Aleynikov
Routing R&D, IDT Telecom
Tel: +1 (973) 438-3436
Fax: +1 (973) 438-1464



More information about the erlang-questions mailing list