[erlang-questions] CPU affinity and enif_thread_create
Mon Aug 22 21:19:13 CEST 2011
On Mon, Aug 22, 2011 at 8:08 PM, Rickard Green <> wrote:
> enif_thread_create() and erl_drv_thread_create() will set the affinity of the newly created thread to the same as the affinity of the main thread (or you have found a bug). Binding of scheduler threads does not effect the affinity of the main thread. However, if you create the thread any other way (e.g. by calling pthread_create() directly), the newly created thread will inherit the affinity of the scheduler thread it happens to execute on (and it may also inherit other unwanted stuff).
I use R14B03 and I threads are started via pthread_create (inside of libx264).
But after this happens very strange situation: htop shows that started
threads doesn't have any affinity.
If I set affinity, threads are spread across cores. Looks like erlang
has nothing to do with it.
More information about the erlang-questions