Setting CPU Affinity

Mark Hammond mhammond at keypoint.com.au
Tue May 4 07:51:33 EDT 2004


Laughlin, Joseph V wrote:
> When I spawn a new process via spawnv(), how can I set the CPU affinity
> for the newly-spawned process with python?

The pywin32 (win32all) extensions include the win32 functions for this 
in the win32process module.  You should be able to:
* use spawmv to get the new process ID.
* use win32process.OpenProcess() to get a process handle.
* use win32process.SetProcessAffinityMask() to set the affinity.

Mark.



More information about the Python-list mailing list