I am wondering about the quantitative impact of tuning ProcessThread.ProcessorAffinity property. What are the particular use cases of the such property
In particular, I have a bi-processor machine that support an intensive CPU/Disk .Net application (scientific computing). In this application, I have sereval threads with distinct priorities (basically one thread with high priority, the few other with low priority). Should I manually assign the high priority thread to one processor and the other threads to the second processors
I know that the only certain answer would be to do extensive mesurements. But I would rather have some insights on the theoretical impact of such property before digging in the raw perf mesurements.
Thanks in advance,
Joannes

ProcessThread.ProcessorAffinity performance impact?
Mehul Thakkar
Ultimately going down this path without extensive testing is likely to result in a big disappointment.
Radical
Some general advice w/out being privy to the details of your situation: I would recommend simply setting priorities and letting the OS schedule your work accordingly. If you have a runnable high priority thread and 5 lower priority threads, Windows will probably just assign your high priority thread to a processor and let the other 5 round robin on the other (provided anti-starvation doesn't kick in). This--if I understand correctly--is what you desire anyhow. So in all likelihood it will just work for you.
Windows uses soft affinity on threads automatically. That is, it prefers to run your runnable task on the same processor it ran on last time. This is in an attempt to maintain cache warmth. One example of where affinity might be a good idea beyond this policy, however, is if you're on a dual-core machine and have two tasks that cooperate on the same set of data. In this case, you might want them to share the cache hierarchy; to "force" that, affinity might come in handy.
If you want to follow up, feel free to email me directly: joedu@microsoft.com.
Hope this helps.
Joe Duffy
Program Manager, CLR Team
Microsoft