Reputation: 243
I'd like to set the cpu-affinity of multiple particular threads.
All the references I've found so far deal with setting the cpu-affinity of a process(PID) but not a thread. Is there a way to accomplish this while using .Net Runspaces? Or am I trying to do something impossible?
The basic idea is: I have a 20 core box and would like to get the threads spread evenly between the cores. Otherwise they all wind up pounding on a single core.
Thanks!
Upvotes: 0
Views: 788
Reputation: 8019
I'm not sure about a .Net wrapper, but the Win32 api SetThreadAffinityMask does what you need - see documentation here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686247(v=vs.85).aspx.
Upvotes: 1