[erlang-questions] ets vs list

Kenneth Lundin kenneth.lundin@REDACTED
Tue Sep 14 19:22:01 CEST 2010


On Tue, Sep 14, 2010 at 11:02 AM, Johan Montelius <johanmon@REDACTED> wrote:
> While we're talking ets tables:
>
> Wouldn't it be nice to be able to send table references across nodes? Today
> when you create a new tabel you get a table reference that is an integer.
> The table can only be accessed by processes in the same node and god know
> what will happen if you send the reference over to another node where there
> is another table registered under the same number.

>From the very beginning ets-tables almost in the way you suggest i.e
the table identifier was location transparent
and could be used in any process on any node.

OTP R7B released 2000 was the last version that worked like that.
Unfortunately I don't remember exactly why we removed the distribution
support from ets except that it caused more problems than it solved. I
also remember that it was no problem to remove this feature, i.e it
was not much used.

I will check why we removed it and come back.

/Kenneth , Erlang/OTP Ericsson

>
> Since tables have a mutable state they should be modeled as processess. When
> you create a table you get a process identifier. Locally on the node where
> the table was created all operations are done as usual i.e. direct access to
> the table without the overhead of sending messages. When you send the
> process identifier over to another node however, a process identifier is
> sent that refers to a proxy process on the originating node.
>
> Using the functions in the ets module using a regular process identifier
> would result in messages being sent to that process and replies being
> received. Just like accessing a local ets table (slower and we have to have
> some error codes if the process is dead).
>
> One could the also open up for a asynchronous access to the table:
>
>   Ref = ets:lookup_and_send_me_the_reply(Table, Key),
>   do_something(),
>   receive
>        {Ref, Value} ->
>
> How's that :-)
>
>  Johan
>
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list