Process connection

Is it possible to programmatically either using win32API (python) or using a command line option to set the processor affinity for a process?

+1


source to share


2 answers


Using a process handle, you can call the SetProcessAffinityMask Win32 API function to set the proximity of a processor to another process. Note that all the usual security restrictions apply, which means you can probably change a process's affinity for its own process.



+3


source


In C / C ++, you can use SetThreadIdealProcessor () . I don't know if this is available in python.



DWORD processorId = 0;
SetThreadIdealProcessor(GetCurrentThread(),processorId);

      

0


source







All Articles