Boost logo

Boost :

Subject: [boost] [spinlock] Spin on volatile read, NUMA fairness?
From: Benedek Thaler (thalerbenedek_at_[hidden])
Date: 2014-12-03 14:48:37

Hi All, Niall,

I was reading this Intel paper [0], and this section grabbed my attention:

"One common mistake made by developers developing their own spin-wait loops
is attempting to spin on an atomic instruction instead of spinning on a
volatile read. Spinning on a dirty read instead of attempting to acquire a
lock consumes less time and resources. This allows an application to only
attempt to acquire a lock only when it is free."

As I can tell by looking at the source code, spinlock spins on atomic
consume. I wonder if a volatile read would produce better performance

AFAIK spinlocking is not necessarily fair on a NUMA architecture. Is there
something already implemented or planned in Boost.Spinlock to ensure
I'm thinking of something like this: [1]




Boost list run by bdawes at, gregod at, cpdaniel at, john at