[Python-Dev] Atomic instructions for reference count increment/decrement

Daniel Stutzbach daniel at stutzbachenterprises.com
Thu Dec 18 04:18:26 CET 2008


On Wed, Dec 17, 2008 at 7:33 PM, Arnar Birgisson <arnarbi at gmail.com> wrote:

> >From the discussion about getting rid of the GIL lately, what I read
> from it is that reference counting is the main obstacle. My question
> is, why aren't hardware supported atomic increments and decrements
> being used for the reference counters?


As far as I'm told they are
> available on most modern platforms (on x86 it is the LOCK instruction
> prefix)


True.


> and these incur little overhead.


False, due to the costs of maintaining cache coherency.

I'd be very happy with pointers to previous discussion on the matter
> or simple arguments why this would not apply to the Python reference
> counting mechanism.
>

Adam Olsen actually tried it.  See:
http://mail.python.org/pipermail/python-dev/2007-September/074645.html

Other message in that thread describe the problem in more detail.

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20081217/165cae96/attachment.htm>


More information about the Python-Dev mailing list