I'm currently working on a project where timing is extremely critical. In my implementation, I've been using spin locks for synchronization. However, I've noticed that the _mm_pause instruction, commonly used in these scenarios to reduce CPU usage and improve the performance of other threads, is adversely affecting my timing precision.
To address this, I've temporarily switched to using __nop (No Operation), which seems to do the trick by reducing the overhead. But before I settle on this, I wanted to reach out to the community for advice Are there any known alternatives to _mm_pause that are more suitable for timing-sensitive applications? Could there be any potential downsides to using __nop in a spin lock, considering it might lead to higher CPU usage due to continuous spinning? I’m also open to exploring other synchronization methods or techniques that might be more efficient than spin-waiting in a multi-threaded environment. Any suggestions on this front? thanks !