
On 01/21/2010 09:10 PM, strasser@uni-bremen.de wrote:
Zitat von Tim Blechmann
: as rule of thumb, i am using spinlocks in the following cases: - locks are acquired very rarely - critical region is very short (a instructions) - the number of threads to be synchronized is lower than the number of cpu cores - the synchronized threads have a similar (possibly real-time) priority
a set of condition also known as "never" ;-)
almost never ;)
if the lock is acquired "very rarely" what is the advantage of a spinlock anyway?
sry, i wanted to write: `in very rare cases different threads try to acquire a lock' spinlocks are low-level primitives and they shouldn't be used, unless you want to avoid that the os preempts the locking thread. cheers, tim -- tim@klingt.org http://tim.klingt.org There's no such entity as "most people". These are generalities. All generalities are meaningless. You've got to pin it down to a specific person doing a specific thing at a specific time and space. William S. Burroughs