[pypy-dev] Thread/gil/java question

Samuele Pedroni pedronis at strakt.com
Thu Dec 29 19:39:48 CET 2005

Drumheller, Michael wrote:
> I am familiar with the GIL limitation on Python concurrency, e.g.,
> <<http://codespeak.net/pypy/dist/pypy/doc/low-level-encapsulation.html#c
> oncurrency>>
> Does anyone know whether Java has a similar limitation?  (Yes: I have no
> experience with Java at all.)

notice that the GIL is an implementation detail of CPython, not part of 
Python semantics.

Java implementations don't have global locks (usually) in CPython GIL 
sense, also Java builtin datatypes and bytecode granularity is such that 
not much could be assumed for user programs even in the presence of such 
a lock. Whether the Java specification would forbid such a lock is a 
different matter.

Jython also doesn't have a GIL. It is still true that because of the GIL 
in CPython that Python multithreading programs usually make assumptions 
about some operations on/involving only builtin types and no callbacks 
to user code to be atomic. Jython uses locks but no single global lock 
to try to respect these de-facto semantics.

More information about the Pypy-dev mailing list