Memory barriers vs lock/unlock

Paolo Carlini pcarlini@suse.de
Tue Nov 8 22:32:00 GMT 2005


Kurt Kohler wrote:

>I don't supposed it's *that* much of a coincidence, but I was
>considering mentioning that I heard Paul give a talk here in Corvallis a
>few weeks ago. He talked about memory barriers (and locks) and
>recommended against them because of their cost in time. I suspect he'd
>approve of a solution that didn't use any.
>
>His basic premise (as I understand it) was that as processors become
>faster, the time to do the real work in a critical section is getting
>smaller and smaller compared to the price of locking (or memory
>barriers). I think it would be fair to summarize his talk as "locks
>considered harmful!"
>
Yes, we know that, or, better said, Peter knows that very well. On the
other hand, I suppose McKenney also explained that lock-free programming
is hard, very hard at times. Herb Sutter wrote some nice jokes about
this here:

    http://www.acmqueue.com/modules.php?name=Content&pa=showpage&pid=332

We are all moving in that direction, anyway.

Paolo.



More information about the Libstdc++ mailing list