Hi Magnus,<div><br></div><div>Thank you! </div><div><br></div><div>So, that's to say if we don't give the erlang shell a node name, they can't send each other messages, right?</div><div><br></div><div>And if I understand you correctly, the two erlang shells have their own schedulers and run-queues independently, and the two (OS) process could run on the same core or on different cores simultaneously. Is it right?</div>
<div><br></div><div><br></div><div>Regards,</div><div>Barco</div><div><br><div class="gmail_quote">On Tue, Nov 15, 2011 at 12:14 PM, Magnus Klaar <span dir="ltr"><<a href="mailto:magnus.klaar@gmail.com">magnus.klaar@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi!<div><br></div><div>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).</div>

<div><br></div><div>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.</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div></font></span><div><span class="HOEnZb"><font color="#888888">/ Magnus<br><br></font></span><div class="gmail_quote"><div><div class="h5">On Tue, Nov 15, 2011 at 3:45 AM, Barco You <span dir="ltr"><<a href="mailto:barcojie@gmail.com" target="_blank">barcojie@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Dear Erlangers,<div><br></div><div><br></div><div>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.</div>


<div><br></div><div>However, we can still send messages between shells on the same machine by starting them as nodes:</div><div>>erl -sname bar -setcookie barco                                                    >erl -sname foo -setcookie barco</div>


<div><div>Eshell V5.8.4  (abort with ^G)                                                         Eshell V5.8.4  (abort with ^G)</div></div><div><div>(bar@youjie-nb)5> register(bar,self()).                                              (foo@youjie-nb)1> {'bar@youjie-nb',bar} ! "hello bar!".</div>


<div>true                                                                                              "hello bar!"</div><div>(bar@youjie-nb)6> flush().</div><div><div>Shell got "hello bar!"</div><div>


ok</div></div></div><div><br></div><div>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?</div>


<div><br></div><div>Any insight would be appreciated.</div><div><br></div><div><br></div><div>Best regards,</div><div>Barco</div>
<br></div></div><div class="im">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></div></blockquote></div><br></div>
</blockquote></div><br></div>