multi-CPU, GIL, threading on linux

gabor gabor at nekomancer.net
Tue Jun 14 06:44:50 EDT 2005


hi,

as i understand, on linux, python uses the operating systems threads
(so python is not simulating threads by himself).

that means that on a multi-CPU computer, the different threads may get 
executed on different CPUs.

i am working with zope, and i was referenced to this page:
http://www.zope.org/Members/glpb/solaris/report_ps

it's rather old (2002), but it claims the following:


 > I do *not* recommend running Zope on multiprocessor machines without an
 > ability to restrict Zope to execution on a single CPU.
 >
 > The reason for this is that the Python Global Interpreter Lock is shared
 > inside a Zope process.  However, threads in Python are backed by
 > underlying OS threads.  Thus, Zope will create multiple threads, and
 > each thread is likely to be assigned to a different CPU by the OS
 > scheduler.  However, all CPUs but one which are dispatching any given
 > Zope process will have to then wait and attempt to acquire the GIL; this
 > process introduces significant latency into Python and thus into Zope.

now, i know about tools that allow me to bind a python process to a 
specific cpu, but i wonder..


is the performance soo bad when i am running a python process, and the 
threads are running on different cpus?

i understand that because of the GIL i cannot make my application 
faster. but slower?

thanks,
gabor



More information about the Python-list mailing list