Will multithreading make python less popular?

Christian Heimes lists at cheimes.de
Thu Feb 19 21:19:15 EST 2009


Mensanator wrote:
> I thought of that, but the usual Windows crap accounts for only a
> couple percent prior to the Python program running. Christian Heimes
> answer sounds more realistic.
> 
> But what do I know?

Be happy that your program makes use of both cores? :]

You can restrict your program from using more than one core by setting
the cpu affinity. On Windows the pywin32 packages wraps all necessary calls:


phandle = win32process.GetCurrentProcess()
win32process.SetProcessAffinityMask(phandle, mask)


Past week I've written a wrapper for the Linux syscalls
sched_setaffinity and friends. I may be able and allowed to release the
stuff in a few weeks.

Christian




More information about the Python-list mailing list