Hacker News new | ask | show | jobs
by haydn3 2356 days ago
What Linus is really saying is that the way Skarupke measured the spinlock being 'bad' is wrong. Skarupke tried to measure it in C, but you can never be sure if you're not being scheduled by anything else.

Skarupke inaccurately defined this as 'mutex vs. spinlock' and an ongoing debate surrounding this as they are comparable, when in no way are they comparable as in userland you simply cannot use spinlocks.

The Windows scheduler apparently doesn't do this, and handles spinlocks better; whatever that means. But the way it works is that spinlocks should work poorly if you run them poorly. Full manual-control of when running a spinlock in userland, you will be scheduled by other things, and you should know that.

That's what Linux is really about. The ability to do something and not have the system "better-ize" it like Windows does by doing some black magic and running an unknown process alongside your spinlock to make it run better.

A spinlock run in userland SHOULD be scheduled by other things, as Linus says. As Linus implemented in the kernel.