开发者

How can I ask the OS to run each thread on another core?-Linux OS

I am trying to run a multiple threads program on a 4 core processor, and I want each thread to开发者_开发知识库 run on a different core.

How can I do that? Because right now I see that they all running on the same core.

(I'm using Linux OS and my code was wrriten on c.)


Process schedulers make processes have an affinity towards a specific CPU. You've already loaded a bunch of stuff into cache, you may as well keep using this 'hot' cache.

You may be getting all the threads on this same core, since you already have the program loaded here.

I did find this: pthread_setaffinity_np. It seems clumsy, but i hope it's of some use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜