atom (symbol) interning across distributed instances of runtime

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

atom (symbol) interning across distributed instances of runtime

Glenn Kasten
I'm curious about the implementation of message-passing of atoms (symbols) 
among unrelated runtime instances, in particular how the atoms are interned.
I would assume that among a single runtime instance, atoms are passed
as small integers rather than strings, yet that would not work between unrelated runtime instances
unless the atoms are interned to a consistent value per atoms.
For example, at first connection between runtimes, do the runtimes undergo
an atom negotiation protocol so they can agree on the interned values?
Or something else?
Glenn






--
Glenn Kasten
Android Media
x35392

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: atom (symbol) interning across distributed instances of runtime

Roger Lipscombe-2
Assuming you're talking about passing atoms between different Erlang
nodes using Erlang distribution, you're looking for the "External Term
Format" documentation:
http://erlang.org/doc/apps/erts/erl_ext_dist.html

Atoms are passed as length-prefixed strings. Except where they're
cached. I don't know anything about how that works.

On 6 February 2018 at 16:13, Glenn Kasten <[hidden email]> wrote:

> I'm curious about the implementation of message-passing of atoms (symbols)
> among unrelated runtime instances, in particular how the atoms are interned.
> I would assume that among a single runtime instance, atoms are passed
> as small integers rather than strings, yet that would not work between
> unrelated runtime instances
> unless the atoms are interned to a consistent value per atoms.
> For example, at first connection between runtimes, do the runtimes undergo
> an atom negotiation protocol so they can agree on the interned values?
> Or something else?
>
> https://en.wikipedia.org/wiki/Symbol_(programming)
> https://en.wikipedia.org/wiki/String_interning
>
> Thanks,
> Glenn
>
>
>
>
>
>
> --
> Glenn Kasten
> Android Media
> x35392
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: atom (symbol) interning across distributed instances of runtime

Lukas Larsson-8
In reply to this post by Glenn Kasten
There is an atom caching algorithm that is used. It is described here: http://erlang.org/doc/apps/erts/erl_ext_dist.html#distribution_header

tldr; atoms are integers inside the same VM. atoms are strings when sending in-between nodes, but there is a cache that uses the integers of the remote node to send atoms.

Lukas

On Tue, Feb 6, 2018 at 5:13 PM, Glenn Kasten <[hidden email]> wrote:
I'm curious about the implementation of message-passing of atoms (symbols) 
among unrelated runtime instances, in particular how the atoms are interned.
I would assume that among a single runtime instance, atoms are passed
as small integers rather than strings, yet that would not work between unrelated runtime instances
unless the atoms are interned to a consistent value per atoms.
For example, at first connection between runtimes, do the runtimes undergo
an atom negotiation protocol so they can agree on the interned values?
Or something else?
Glenn






--
Glenn Kasten
Android Media
x35392

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: atom (symbol) interning across distributed instances of runtime

Glenn Kasten
Thank you Roger and Lukas, that was exactly what I needed.

On Tue, Feb 6, 2018 at 9:06 AM, Lukas Larsson <[hidden email]> wrote:
There is an atom caching algorithm that is used. It is described here: http://erlang.org/doc/apps/erts/erl_ext_dist.html#distribution_header

tldr; atoms are integers inside the same VM. atoms are strings when sending in-between nodes, but there is a cache that uses the integers of the remote node to send atoms.

Lukas

On Tue, Feb 6, 2018 at 5:13 PM, Glenn Kasten <[hidden email]> wrote:
I'm curious about the implementation of message-passing of atoms (symbols) 
among unrelated runtime instances, in particular how the atoms are interned.
I would assume that among a single runtime instance, atoms are passed
as small integers rather than strings, yet that would not work between unrelated runtime instances
unless the atoms are interned to a consistent value per atoms.
For example, at first connection between runtimes, do the runtimes undergo
an atom negotiation protocol so they can agree on the interned values?
Or something else?
Glenn






--
Glenn Kasten
Android Media
x35392

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions





--
Glenn Kasten
Android Media
x35392

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions