what's the point of rpython?
Carl Banks
pavlovevidence at gmail.com
Mon Jan 19 23:27:51 EST 2009
On Jan 19, 8:00 pm, "Brendan Miller" <catph... at catphive.net> wrote:
> Maybe I'm missing something here but a lock free algorithm for
> reference counting seems pretty trivial. As long as you can atomically
> increment and decrement an integer without locking you are pretty much
> done.
You're missing that most of the platforms that Python supports can't
actually do this. Keep in mind that it has to be atomic across all
cores.
(For Python to use such a technique, it would have to be doable on
every platform Python supports. They aren't going to get rid of the
GIL for some platforms and not others.)
> For a reference implementation of lock free reference counting on all
> common platforms check out boosts implementation of shared_ptr (a
> reference counting smart pointer designed around multithreaded use
> cases).
I just looked at the boost documentation, which claims that multiple
asynchronous writes to the same shared_ptr results in undefined
behavior. That will not suffice for Python reference counting.
Carl Banks
More information about the Python-list
mailing list