On multicore erlang/elixir, hint processes which core to run on?

For multicore erlang/elixir, is there anyway to provide processes hints on which core to run on ?

Even if possible - sounds non trivial and definitely not something we do often :grinning_face_with_smiling_eyes:

  1. Erlang VM spawns N OS threads. By default N is the same as the number of available CPU cores. However, it’s up to the OS to run those threads on separate cores…
  2. Erlang VM runs a Scheduler per each thread.
  3. Finally, erlang process is picked up by one of the schedulers. And even then, at some point erlang process might migrate to a different scheduler.

So even if there is a way to force the process to stick with particular scheduler the next level would be to guarantee that the OS thread scheduler runs on doesn’t migrate to a different core.

2 Likes

A cursory google search of 'erlang processor affinity" yields some interesting… threads :roll_eyes:

How, if at all, do Erlang Processes map to Kernel Threads?

[erlang-questions] “processor affinity” for processes

1 Like