Threaded GUI slowing method execution?

sturlamolden sturlamolden at
Fri Oct 2 20:09:47 CEST 2009

On 2 Okt, 13:29, Dave Angel <da... at> wrote:

> Many people have concluded that (in Python) much of what threads are
> used for should be done with processes.

Remember that threads were invented long before multi-core CPUs were
common. Java had threads before the VM could support more than one
CPU. The early Linux kernel had threads despite of the BKL, etc.
Threads have more usage than concurrent CPU bound busy work.

If you need to program multi-cores for speed, consider that you incur
a 200x speed penalty from Python alone.  If you are worried about
speed, chances are you are not using Python anyway.

If you still have "need for speed" on a multicore, you can use Cython
and release the GIL when appropriate. Then launch multiple Python
threads and be happy.

In C, C++ and Fortran, one would not use threads for multicore
programming at all, but OpenMP.

Using more than one process is always an option, i.e. os.fork if you
have it or multiprocessing if you don't. Processes don't share GIL.


More information about the Python-list mailing list