CPU Affinity Masks (Putting Threads on different CPUs)

前端 未结 3 1388
孤城傲影
孤城傲影 2020-12-14 09:07

I have 4 threads, and I am trying to set thread 1 to run on CPU 1, thread 2 on CPU 2, etc. However, when I run my code below, the affinity masks are returning the correct va

3条回答
  •  感情败类
    2020-12-14 09:36

    I think the easiest would be to give the CPU mask as a parameter to each thread and have the thread request given affinity itself, as in example here: pthread_setaffinity_np(3).

提交回复
热议问题