I want my program to open some other processes, and one of the requirements of the project is that each process opened can only be run on a single core.
I know that a specific processor can be picked with processorAffinity but is it possible to set a maximum number of cores (in my case 1)?
Best How To :
you have to try with ProcessThread.ProcessorAffinity
static void Main(string args)
// Make sure there is an instance of notepad running.
Process notepads = Process.GetProcessesByName("notepad");
if (notepads.Length == 0)
// Retrieve the Notepad processes.
notepads = Process.GetProcessesByName("Notepad");
// Get the ProcessThread collection for the first instance
threads = notepads.Threads;
// Set the properties on the first ProcessThread in the collection
threads.IdealProcessor = 0;
threads.ProcessorAffinity = (IntPtr)1;