Jython, GILs and object locking.

Michael Chermside mcherm at mcherm.com
Fri Oct 10 17:47:43 EDT 2003


Jon Franz writes:
> Yes, and I'm willing to bet 5$ that the Zope developers would
> love a true freethreaded interpreter, since Zope is limited on
> big hardware by the GIL-ized interpreter preventing multiple CPUs
> being used.  Using ZEO to run multiple copies of Zope localy
> on the same datastore is a silly workaround.

I agree, I'm sure they'd be happy with a GIL-free Python.

> I see a big gaping hole in your list of reasons for needing threads.
> Big, I/O bound network servers can benefit greatly from
> threads on multiple CPUs.

Um... I don't get it. If the speed of the application is
limited by I/O operations, then how would it help to run on
more CPUs? The speed is still limited by the I/O operations.

> Multi-process programming is
> not for everyone, and has its own issues it introduces to
> the mix when you attempt to write applications with it.
 
I certainly agree here. Once you've reached the point where
a multi-process approach actually improves your performance,
you've crossed the line into the area where the GIL is a
problem.

> I think, however, that until (IF) the GIL is removed, a
> simple documentation change could be very useful.

Only if it's not misleading.

> That is, in the thread module docs, and the tutorials (and
> anyplace that mentions threading) mention that python, due to 
> the GIL, cannot use multiple processors.

In principle, I think mentioning this is a good idea.
HOWEVER, I have seen lots of newbies who think that Python
can't use threading (at all!) because of the GIL. And
that's simply wrong. So the warning would need to be
worded very carefully.

> ...probably not as true as you think.  No offense.

None taken, of course. My own experiences are necessarily
limited, and there's a lot (or anyone!) can learn by listening
to other's ideas of what is (or isn't) common practice.

-- Michael Chermside






More information about the Python-list mailing list