[Python-ideas] Optimistic Concurrency

Adam Olsen rhamph at gmail.com
Mon Oct 20 22:58:25 CEST 2008

On Mon, Oct 20, 2008 at 2:33 PM, Leonardo Santagada <santagada at gmail.com> wrote:
> On Oct 20, 2008, at 6:12 PM, Adam Olsen wrote:
>> Stepping back a bit, there's two distinct problems to solve:
>> 1) Making threading easier
>> 2) Removing the GIL
>> #1 can be done by things like monitors and transactions (the two are
>> complementary).  #2 at its core is about refcounting, and transactions
>> are irrelevant there — you need to switch to a tracing-based GC
>> implementation
> PyPy has a real GC and doesn't depend on refcount already. So that is not
> the only thing needed to accomplish #2, you need to lock mutable data
> containers so concurrent threads don't leave them in a broken state. This is
> the part not ready on PyPy yet.
> But it is probably easier to fix on PyPy than on CPython.

Although #2 does depend on it, providing sane and safe semantics for
the datastructures is the domain of #1.

Keep in mind that very little in python actually needs implicit
concurrent mutation (class and module dicts do).  Implicit thread
interaction is the fundamental problem of the current threading
models, for all the reasons spelled out in the zen.

Adam Olsen, aka Rhamphoryncus

More information about the Python-ideas mailing list