r/programming • u/david-alvarez-rosa • Sep 09 '26
Optimizing a Spin-Lock
https://david.alvarezrosa.com/posts/optimizing-a-spin-lock/
183
Upvotes
r/programming • u/david-alvarez-rosa • Sep 09 '26
View all comments
Show parent comment
1
u/lenazh Sep 10 '26 edited Sep 10 '26
You'd normally find them in kernel mode in things like interrupt handlers, or any other context where you can't yield the thread.
Niche userspace uses would be when you want to time something precisely, like have two threads start a task as simultaneously as possible while being signaled by another thread. Or maybe send out udp packets exactly 1us apart from a user-space driver or something else where latency and jitter are important.