Re:A spin lock in C that does not require a machine level ex...
by michaelmior on Sunday May 04, 2014 @08:14PM
(#7696401)
I'm confused why the description refers to it as a "user level" spinlock. Are there some architectures where exchange is a privileged operation?
[ Parent
| on HN ]
Re:A spin lock in C that does not require a machine level ex...
by tsu on Sunday May 04, 2014 @08:59PM
(#7696529)
compare-and-swap instruction itself may not be privileged operation but user space spin-lock seldom work in user-space (it's dangerous at least), because a user thread could be preempted.
Re:A spin lock in C that does not require a machine level ex...
by jacquesm on Sunday May 04, 2014 @09:07PM
(#7696543)
What's even more dangerous, on a single core machine or one that is lightly loaded without any aggressive contention for the lock it may even seem to be working.
Re:A spin lock in C that does not require a machine level ex...
by michaelmior on Sunday May 04, 2014 @09:20PM
(#7696567)
Ah yes, good point. I had forgotten about that issue.