Remix.run Logo
mgaunard 11 hours ago

Most people looking for performance will reach for the spinlock.

The expectation is that the kernel should somehow detect applications that are spinning, and avoid preempting them early.

silon42 26 minutes ago | parent | next [-]

If you are spinning so long that it requires preemption, you're doing something wrong, no?

jcalvinowens 19 minutes ago | parent [-]

It doesn't matter, it's a long tail thing: on average user spinlocks can work, and even appear to be beneficial on benchmarks. But if you have enough users, some of them will experience the apocalyptic long tail, no matter what you do: that's why user spinlocks are unacceptable.

IshKebab 11 hours ago | parent | prev [-]

Well that seems like an unreasonable expectation no? Also isn't the point of spinlocks that they get released before the kernel does anything? Otherwise you could just use a futex... Which maybe you should do anyway...

https://matklad.github.io/2020/01/04/mutexes-are-faster-than...