[erlang-questions] CPU affinity and enif_thread_create

Max Lapshin <>
Sun Aug 21 22:47:22 CEST 2011


I've created libx264 encoder in nif and started new thread for it.
libx264 was started with option threads 4 and it really created 4 threads.

Now I have problems. All created threads are bound to one CPU core and
it is not enough. 100% busy and I have to drop frames.

I have installed linux kernel with BFS (brainfuck scheduler), but it
didn't change anything.

So I have called sched_setaffinity by hands and libx264 threads spread
across cores.

And I have questions: does erlang VM makes some calls, that bind
future created threads to current core?

If no, that why doesn't erlang VM moved to other cores busy processes
that had several hundred messages inbox?
Maybe I should do some hinting like  "bump_reductions" to tell VM to
switch process to another scheduler?



More information about the erlang-questions mailing list