[pypy-dev] GIL in non-Python languages
tbaldridge at gmail.com
Mon Mar 7 17:48:38 CET 2011
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 of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
More information about the Pypy-dev