Atomic instructions for reference count increment/decrement
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
Hi all, I'm new here, so bear with me. I tried googling this, but the closest I came up with was a post from 2000. prefix) and these incur little overhead. 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. cheers, Arnar
On Wed, Dec 17, 2008 at 7:33 PM, Arnar Birgisson <arnarbi@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>
participants (2)
-
Arnar Birgisson -
Daniel Stutzbach