开发者

creating thread on another core? (WinAPI)

I was wondering if there was a way to run a thread on a seperate core instead o开发者_StackOverflow社区f just a thread on that core? Thanks


If you create a thread, you have by default no control on which core it will run. The operation system's scheduling algorithm takes care of that, and is pretty good at its job. However, you can use the SetThreadAffinity WinAPI to specify the logical cores a thread is allowed to run on.

Don't do that unless you have very good reasons. Quoting MSDN:

Setting an affinity mask for a process or thread can result in threads receiving less processor time, as the system is restricted from running the threads on certain processors. In most cases, it is better to let the system select an available processor.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜