What is the difference between thread affinity and process affinity?

The process affinity is the default affinity mask for all threads belonging to that process. New threads will start with the process affinity mask if not specified otherwise. However, the affinity of a single thread can be changed without changing the process affinity (and the affinity masks of the other threads), and that's when there is a difference between process and thread affinties.

The process affinity is the default affinity mask for all threads belonging to that process. New threads will start with the process affinity mask if not specified otherwise. However, the affinity of a single thread can be changed without changing the process affinity (and the affinity masks of the other threads), and that's when there is a difference between process and thread affinties.

If I have two Threads and I have duel core machine then is it possible to run these two threads parallely on the two cores? Yes it is possible, but in most cases, you really should let the operating system decide... most likely it is smarter than you. If I use processor affinity Mask then I can control execution of a process on the cores but when I have to run threads on a particular core how can I make these threads core specific?

You would have to use p/invoke to call the unmanaged function SetThreadAffinityMask() and then use Thread. BeginThreadAffinity() to ensure that the managed thread stays with a specific OS thread. But you really don't want to do that!

I have tried using SetThreadAffinityMask(), plese have a look at my question @ stackoverflow. Com/questions/2498501/… – DotNetBeginner Mar 24 '10 at 12:39.

I am not aware that you can set thread affinity in . Net, so environment decides which threads to run on which core.

I stand behind my words, that there is no way from . NET to force particular thread to execute on particular processor. See this thread for details: social.msdn.microsoft.

Com/Forums/en-US/Vsexpressvb/thread/… – Axarydax Mar 24 '10 at 12:07 Sorry, I misunderstood you then. – Brian Rasmussen Mar 24 '10 at 12:12.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions