Jython, GILs and object locking.
Luis P Caamano
lcaamano at mindspring.com
Fri Oct 10 20:09:34 CEST 2003
Michael Chermside <mcherm at mcherm.com> wrote in message news:<mailman.1065796468.17154.python-list at python.org>...
> Alan Kennedy writes:
> > That's the first definitive statement I've ever read about Jython not
> > being limited by a GIL on multi-processor machines.
> Well, I wouldn't paint myself as an *expert* in Jython, but I am
> fairly sure that in this I am correct... Jython does not have a
> global lock, and it CAN run different threads in multiple processors
> if the OS and the JVM support doing so.
> > This "macro-level" of locking
> > was chosen because empirical evidence from experimental
> > implementations (a long time ago, in a galaxy far, far, away) showed
> > that it gave better performance than approaches using more
> > fine-grained locking, i.e. object-level locking.
> I'm not so sure about that. I think it is more of a historical
> artifact, but one which would be incredibly difficult to change
> now. Every once in a while someone on python-dev proposes doing
> so, and the old-timers pipe up and say "sounds good, we'd love
> to do away with the GIL but it would require a nearly ground-up
> re-write of cpython, so, well..., send us the patch <wink>".
Before that some people try to put you down claiming that you
can "re-implement" without threads whatever you already have
working with threads, which although true, is not what you'd
like to do. <0.5wink>
Imagine going back to your boss, customer, or investor
to say ... "well, we need to re-architect the whole thing
NOT to use threads because of this little detail unique
to python. You see, there's this GIL in python, which ..."
I have no problem with the statement that removing the GIL
is hard and we don't have the resources to do that now. I
understand that. The statement I don't like is when people
say that "the GIL is not a problem at all and therefore,
it doesn't need fixing."
Luis P Caamano
More information about the Python-list