Is the PyPy GIL part of the PyPy interpreter implementation in RPython, or is it something that translate.py automatically adds? i.e., if I were to write my own new language interpreter in RPython and ran it through translate.py, would it be subject to the GIL a priori, or would that be up to my interpreter code?
Asked
Active
Viewed 2,189 times
1 Answers
12
The GIL handling is inserted by module/thread/gil.py in your PyPy checkout. It's an optional translation feature and it's only added when thread module is enabled. That said, RPython itself is not a thread-safe language (like for example C), so you would need to take care yourself to lock objects correctly, so they don't come up inconsistent. The main issue would be to provide a thread-aware garbage collector, because the one that we use right now is not thread safe and just adding a lock would remove a whole lot of benefits from a free-threading model.
Cheers, fijal

fijal
- 3,190
- 18
- 21
-
1Just for the record, it seems that clojure-py has gotten around the issue by spawning new processes and communicating via erlang-style messages. http://clojure-py.blogspot.com/2012/04/clojure-py-and-distributed-concurrency.html – lobsterism Sep 05 '12 at 05:40