Some relevant discussion: Is std::this_thread::yield any different from sched_yield on linux?
I'm Wondering:
this_thread::yield()
usually needs to switch from user mode to kernel mode- volatile pause still remains in user mode, but cpu pauses for ~30 clocks.
So, yield is more expensive than pause.
Wonder if the above understandings are correct?
I am trying to understand how yield
and pause
work internally.