[pypy-dev] Thread/gil/java question

Drumheller, Michael michael.drumheller at boeing.com
Thu Dec 29 20:09:12 CET 2005

Thank you for the quick response.  Let me get this straight:  If I use
Jython instead of CPython, then my Python threads can migrate to
different CPUs?
Not sure what you meant by "... granularity is such that not much could
be assumed for user programs..."--could you clarify that a bit?
Thank you again.
Mike D.

-----Original Message-----
From: Samuele Pedroni [mailto:pedronis at strakt.com] 
Sent: Thursday, December 29, 2005 10:40 AM
To: Drumheller, Michael
Cc: pypy-dev at codespeak.net
Subject: Re: [pypy-dev] Thread/gil/java question

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