On Nov 2, 2006, at 5:25 PM, David Worrall wrote:

Hi All,
Can anyone tell me whether or not the python threading module can
make use of multiple processors
(such as on the intel Mac)?

It can, but not always optimally. Python has a global interpreter lock (GIL) that is held whenever a thread is executing python byte code. This means only one thread at a time can be executing byte code, however multiple threads can be in C code at the same time.

Therefore it is possible to use multiple CPUs, but only if you have C code that does some calculation without holding the GIL. Note that several GUI API's from Apple, such as CoreImage make automatic use of multiple processors, and even if you don't use multiple processors yourself the other processor won't be completely idle, that can and will be used for background tasks and other programs.

If you want to make full use of multiple processors using pure python code you'll have to use multiple processes.

Ronald

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to