[erlang-questions] Shared ETS Access

Ulf Wiger ulf.wiger@REDACTED
Mon Jan 11 12:45:22 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Zoltan Lajos Kis wrote:
>> # 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
>> ;-).
>>
>> Regards,
>> 	-- Jachym
>>
> 
> This will only become consistent if reads are also done through the
> server. But then the table could be set to private as well (if an ets
> table is needed at all then).

This, as Jachym pointed out, depends on the problem at hand.
If reads are atomic, it may well be perfectly acceptable to allow
direct concurrent reads to the table while serializing writes. If you
need to modify an object in ets, you have to first read the old object,
and this cannot be done safely without serializing through a process.
You might call this "write consistency" perhaps.

A process registry is a simple example of such serialization. You don't
have to go to the server to lookup a {Name,Pid} mapping, but you do
have to in order to safely register it in the first place.
(There is even a paper on this, more or less, from ICFP 2009:
http://portal.acm.org/citation.cfm?id=1596550.1596574)

BR,
Ulf W
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAktLD1IACgkQtqqFieqzed3wKwCg2dPWk3h6mPBKyBHchuT/zXLx
V3MAoNUCeOyri2wEVlJAb1LF+iwLf16w
=oly0
-----END PGP SIGNATURE-----
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list