[erlang-questions] What's the difference between starting erlang vms (pure erl shell) and starting erlang nodes on the same machine?

Magnus Klaar magnus.klaar@REDACTED
Tue Nov 15 05:14:11 CET 2011


You are always starting a new erlang node when you start an erlang shell.
What the -sname parameter does is to also enable distributed erlang on the
node as part of the startup process. You can get the same effect by running
net_kernel:start([bar, shortnames]). and net_kernel:start([foo,
shortnames]). in the shells of two unnamed node (shells as you called them).

You can verify that two unnamed erlang nodes are indeed two separate (OS)
processes running independently by starting two using "erl" and searching
for beam.smp in a process list viewer of your choosing.

/ Magnus

On Tue, Nov 15, 2011 at 3:45 AM, Barco You <barcojie@REDACTED> wrote:

> Dear Erlangers,
> When I start two erl shells on the same machine, I got one shell with pid
> <0.30.0> and the other one with <0.32.0>, and if I send a message on the
> first shell:" list_to_pid("<0.32.0>") ! hello.", the second shell got
> nothing by calling "flush()" on it.
> However, we can still send messages between shells on the same machine by
> starting them as nodes:
> >erl -sname bar -setcookie barco
>          >erl -sname foo -setcookie barco
> Eshell V5.8.4  (abort with ^G)
>             Eshell V5.8.4  (abort with ^G)
> (bar@REDACTED)5> register(bar,self()).
>            (foo@REDACTED)1> {'bar@REDACTED',bar} ! "hello bar!".
> true
>                        "hello bar!"
> (bar@REDACTED)6> flush().
> Shell got "hello bar!"
> ok
> I hope to know the difference between the twos ways of starting erlang
> shell. Can two shells (not as nodes) send each other messages? Will the two
> erlang VMs (I assume one VM for one shell) share the same
> schedulers/run-queues on every core or each one has its own
> schedulers/run-queues on every core? and what about the VMs for nodes?
> Any insight would be appreciated.
> Best regards,
> Barco
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111115/69c901fb/attachment.htm>

More information about the erlang-questions mailing list