"Do I really need to include the processAffinityMask? What if I want to have the thread run outside of the logical cores defined for the process (not the system)."
The answer is written in the MSDN documentation:
"A thread affinity mask must be a subset of the process affinity mask for the containing process of a thread. A thread can only run on the processors its process can run on."
"Then I would use that value (actualAffinity) to set the affinity of the thread (between Thread.BeginThreadAffinity(); and Thread.EndThreadAffinity(); of course)"
Do you also run whatever code you want to run with CPU affinity between that BeginThreadAffinity/EndThreadAffinity pair? Otherwise setting the affinity is likely useless.
Hope you have a good reason to tinker with CPU affinity.
No comments:
Post a Comment