
Is it possible to set thread affinity through boost::thread? I suspect that I am losing performance in my application because the OS is migrating threads and causing cache thrashing... James

On Thu, Jul 07, 2011 at 07:16:04PM -0600, James C. Sutherland wrote:
Is it possible to set thread affinity through boost::thread? I suspect that I am losing performance in my application because the OS is migrating threads and causing cache thrashing...
The question arose on the IRC channel a week ago or so. There is no such functionality in Boost.Thread, you need to use native functions like the GNU pthread_setaffinity_np (non-standard) or the Windows SetThreadAffinityMask. On Linux, sched_setaffinity may or may not work, depending on what you and your OS considers a "PID". Of course, you could always write a patch targetting the platforms where such functionality exists and suggest it for inclusion. -- Lars Viklund | zao@acc.umu.se
participants (2)
-
James C. Sutherland
-
Lars Viklund