Multi-threading on Multi-CPU machines

Christopher Saunter Christopher.Saunter at durham.ac.uk
Tue Jul 9 05:31:11 EDT 2002


Garry Taylor (gtaylor at lowebroadway.com) wrote:
: Hello,
: I am attempting to make a multi-threading function in one of my
: programs in an effort to gain a speed increase, but I'm getting quite
: the opposite, even on a dual-CPU Intel/Linux box. Can anyone enlighten
: me as to why, my code is below:

<snip code>

Hi Gerry,
	As other people have said, 'native' Python code does not bennefit
from multiple CPUs in one PC due to the GIL.  Depending on what you are
doing with your threads, you may be able to utilise more then one
processor by splititng the threads into multiple programs, running them
simultaneously and communincating between them somehow (MPI etc...) - from
what I have seen it requires a little more effort, but can work well.
This is mainly usefull for 'number crunching' threads etc.

---

cds



More information about the Python-list mailing list