4 ms·
> Why isn't the conclusion to just ... Sigh. From the article itself: > I hope to have convinced you to avoid spinlocks, even for very short sections. Spinloc
by banachtarski 7y ago
> Why isn't the conclusion to just ...
Sigh. From the article itself:
> I hope to have convinced you to avoid spinlocks, even for very short sections. Spinlocks are only a benefit if you really really care about the fast path and are certain that the lock will essentially always be free to take. On my computer the fast path on a spinlock is roughly 7ns and on a mutex it’s roughly 14ns, so both of those numbers are very fast. But when spinlocks go bad, the scheduler can be really confused, at least on Linux.
- pedrocr 7y agoI did read it till the end but missed that bit about the fast path somehow. I struggle to see a case where you care enough about those 7ns but the Windows scheduler was a different story.