[erlang-questions] Shared ETS Access

Zoltan Lajos Kis <>
Mon Jan 11 20:23:47 CET 2010


Robert Virding wrote:
> 2010/1/11 Jachym Holecek <>
>
>   
>> # Zoltan Lajos Kis 2010-01-11:
>>     
>>> Is there any advantage in writing to the table through a server process,
>>> instead of directly writing to the table (perhaps using the
>>> write-concurrency switch) ?
>>>       
>> [Answering the general question, didn't track the thread closely.]
>>
>> Depends on the problem at hand. Writing through owner process implies table
>> modifications are serialized in time, this is useful in cases where table
>> holds data complex beyond a simple key-value store or when table contents
>> need to stay in sync with some bits of surrounding world. So "consistency"
>> or at least illusion thereof is the answer.
>>
>> Of course, one remembers to think twice before using ETS acrobatically ;-).
>>
>>     
>
> You have exactly the same problem if you want to do a number of reads which
> are considered to be atomic. In many ways ETS provides a low-level interface
> and often you will need to add a layer above it. This is not a bug but
> definitely a feature and is in accord with a basic principle we had of
> providing tools rather than solutions.
>
> Robert
>
>   
It seems like ETS already provides lock-like functionality in the form 
of atomic multiple-insert/update/delete operations.
Is there a reason these locks are not available for direct manipulation?



More information about the erlang-questions mailing list