News for hackers. Stuff that matters.
Re:Mutexes are faster than Spinlocks by kcolford on Saturday January 04, 2020 @11:17AM (#21955682)
This absolutely makes sense in userspace. The most important part of a spinlock in an OS is that you can yield to the scheduler instead of taking up CPU time on the core. But that defeats the purpose of using a spinlock when in userspace because you still have to syscall
Re:Mutexes are faster than Spinlocks by temac on Saturday January 04, 2020 @04:17PM (#21957635)
A spinlock in the kernel typically only spins. You use it for the cases when you can't schedule... So it better will be for a short time only.

But the concept of short time does not even exist deterministically in userspace, usually, because it can always be preempted. So don't use pure spinlocks in userspace, unless you really really know what you are doing (and that includes knowing how your kernel works in great details, in the context of how you use it).