logoalt Hacker News

mgaunardtoday at 6:30 AM2 repliesview on HN

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.


Replies

silon42today at 5:31 PM

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

show 1 reply
IshKebabtoday at 7:18 AM

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...