I have created a window application in C#.Now I want to set the CPU affinity for this application.I may have 2 processors,4 processors,8 processors or may be more than 8 processors.
I want to set the cpu affinity using input from interface.
How can i achieve this? How can it is possible to set the affinity using Environment.ProcessorCount?
Try this:
Here‘s more about it.
ProcessorAffinity represents each processor as a bit. Bit 0 represents processor one, bit 1 represents processor two, and so on. The following table shows a subset of the possible ProcessorAffinity for a four-processor system.
Here’s a small sample program: