<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 8, 2016 at 6:12 PM, Jung Kim <span dir="ltr"><<a href="mailto:jungkkr@gmail.com" target="_blank">jungkkr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">So I am interested to know how Erlang schedule process without the user inserting code like coroutine.yield() in the function created.</blockquote></div><br>Two observations:</div><div class="gmail_extra"><br></div><div class="gmail_extra">* Every loop has to use a tail-call.</div><div class="gmail_extra">* The interpreter automatically inserts a yield at every 2000 function calls.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Of course, if you end up waiting for a message and none has arrived, you are put on a sleep queue until such a message arrives.</div><div class="gmail_extra"><br></div><div class="gmail_extra">More here:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="http://jlouisramblings.blogspot.dk/2013/01/how-erlang-does-scheduling.html">http://jlouisramblings.blogspot.dk/2013/01/how-erlang-does-scheduling.html</a> .. it is still somewhat up-to-date with the current state-of-the-art.<br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">J.</div>
</div></div>