<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr" class="gmail_attr">On Fri, Feb 21, 2020 at 8:59 PM Karl Velicka <<a href="mailto:karolis.velicka@gmail.com">karolis.velicka@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div><div>(I'm reading your question as "how to pin an Erlang process to a CPU _core_)</div><div><br></div><div>There is an option to erlang:spawn_opt - {scheduler, SchedNum} to pin a process to a specific scheduler in the VM. However, this option is undocumented so it's probably exposed on "caveat emptor" basis. We get the possible scheduler numbers by doing lists:seq(1, erlang:system_info(schedulers_online)) and we've been using the flag in OTP versions 20-22.<br></div></div><div><br></div></div></blockquote><div><br></div><div>This feature was introduced to simplify our testing. It does *not* have product quality and may cause major problems for the system as a whole. Especially if lots of processes are pinned to specific schedulers.<br><br></div><div>In general, using undocumented features or API:s may cause you major problems. They may change behavior or be removed at any time without any notice from us what so ever. You may also not fully understand the effects of using them. Some internal API:s can cause very strange side effects if not used properly. That is, I strongly discourage you from using any undocumented stuff that exist in OTP.<br><br></div><div>A much better approach is to ask us for a new feature or to document an existing feature at <<a href="https://bugs.erlang.org">https://bugs.erlang.org</a>> or make a pull request at <<a href="https://github.com/erlang/otp">https://github.com/erlang/otp</a>>. If/when it gets implemented and taken into OTP of course depends on what it is, how we prioritize it, etc.<br><br></div><div>Before anyone asks us to document the 'scheduler' option of spawn_opt(), I can answer you *no* straight away. At least not without having solved the issues that it can cause, and currently we do not have the time to do that.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>The scheduler itself is just a thread from the perspective of the OS so I assume it shouldn't be difficult to pin to a core.</div><div><br></div></div></blockquote><div><br></div><div>See <<a href="http://erlang.org/doc/man/erl.html#+sbt">http://erlang.org/doc/man/erl.html#+sbt</a>> on how to bind schedulers to logical processors.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>All the best,</div><div>Karl<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 20 Feb 2020 at 17:05, Satish Patel <<a href="mailto:satish.txt@gmail.com" target="_blank">satish.txt@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Folks,<br>
<br>
Can i tell erlang to not load-balance process or migrate process to<br>
different CPU?<br>
</blockquote></div>
</blockquote></div><br clear="all"></div><div>Regards,<br></div><div>Rickard<br></div><div dir="ltr">-- <br><div dir="ltr" class="gmail_signature">Rickard Green, Erlang/OTP, Ericsson AB</div></div></div></div>