I've figured out how to set process affinity mask to run process on just single processor:
Process p = ... //getting required process
p.ProcessorAffinity = (IntPtr)0x0001;
But I can't figure out how to set it back to all processors. How do I do so? Thanks.
According to MSDN
https://msdn.microsoft.com/en-us/library/system.diagnostics.process.processoraffinity(v=vs.110).aspx
So you should put
in order to lift the restrictions (now
p
can be run on any processor: we have11...11
bitmask withN
ones whereN
is the number of the logical processors)