I haven't posted in quite some time, for several reasons. First, I'm working really hard and it's been hard to find time to post. Possibly a bigger issue is that when I'm posting much less often, I find that I lose the blogging mindset. Yet another thing is: I think all day about my company's technology and plans, but can't post about those because they're secret for the time being!
In any case, I ran across a project called python-safethread today. Its intention is to make a version of Python that does without the GIL and has modern constructs for concurrency. Its home page lists some of its major features:
- Exceptions from threads propagate naturally and cause the program to shut down gracefully.
- No memory model is necessary. All mutable objects are safely contained with monitors (similar to Concurrent Pascal's monitors, but different from Java's monitors.)
- Deadlocks are detected and broken automatically.
- Finalization is thread-safe (and uses a much simpler mechanism at a low-level.)
- Most existing single-threaded code will continue to be correct (and in good style) when used amongst threads. Some boilerplate may be necessary to share module and class objects between threads.
- The GIL is removed. Each additional thread should run at or near 100% throughput. However, the base (single-threaded) throughput is only around 60-65% that of normal CPython, so you'll need several threads for this to be worthwhile.
The author says that he's aiming to make it an alternate CPython version ala Stackless, but hopes to incorporate it into mainstream CPython at some point. Right now it's at a very early state of development.
It sounds like a very interesting project, and I thought it was a good item to post about after all this time.
Recent Comments