[pypy-dev] GIL in non-Python languages

Benjamin Peterson benjamin at python.org
Mon Mar 7 17:50:50 CET 2011


2011/3/7 Timothy Baldridge <tbaldridge at gmail.com>:
> I'm in the process of writing a PyPy based Clojure interpreter/JIT.
> One of the man tenants of Clojure is immutability, and one of the
> other tenants is extreme co-currency. Starting soon I'd like to start
> experimenting with co-currency in my interpreter. For those who aren't
> familiar with Clojure, let me give an example:
>
>
> (def my-agent (agent "Hello"))
>
> (send my-agent #(str %1 " World"))
>
> Send then takes the current state of my-agent and then calls the given
> lambda function, passing it the current state of the agent (%1 points
> to the first argument of the lambda). The lambda simply then concats
> the two strings together.
>
> So here's the deal. My entire interpreter is 100% thread safe. All my
> variables are either immutable, or local to the given function. But
> from what I'm hearing on IRC, it sounds like that a GIL will be
> automatically generated in my interpreter after I run it through PyPy.
> I know ripping the GIL out of Python is a major deal. But how about my
> project? If I start with the concept of a GIL-less interpreter, will
> PyPy get in my way? If so, how can I get it to "back-off" a bit?

One major problem is that RPython its self is not really thread-safe.
For example, the gc is very non-concurrent. So, that would have to be
fixed.



-- 
Regards,
Benjamin



More information about the Pypy-dev mailing list