14 ms·
Generally unbounded spins are terrible in userspace, but bounded spins as part of "hybrid" locks generally strike a good balance between performance and system
by saagarjha 3y ago
Generally unbounded spins are terrible in userspace, but bounded spins as part of "hybrid" locks generally strike a good balance between performance and system impact. When a system call is hundreds or thousands of cycles it can be quite effective to try spending some fraction of that yourself if it'll get you the lock without the syscall. Like, not just from a pure throughput perspective: a yield to the kernel is not "free", it takes time just to park yourself. So it's good to make a gamble usually.