Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Interesting, thanks for the detailed explanation. It begs the question, though: doesn't the OS have to use computational resources to evaluate the mutex lock or other sync primitive? Is the point that the OS will spend less resources on resolving the condition than a spin-locked thread (however implemented)? Commented Jun 18, 2021 at 22:17
  • @msmoiz: "doesn't the OS have to use computational resources to evaluate the mutex lock or other sync primitive?" That depends on how you define "resources". Yes, the OS has to store what thread(s) are blocked on a synchronization primitive. But that's not a busy-wait; it's just some data structures stored somewhere the OS has access to. As far as the CPU is concerned, it's off doing something unrelated. Commented Jun 18, 2021 at 22:44
  • You could call it a "busy wait" in the same way you could call it a "potato peeler" - it's not one, but you won't be struck by lightning for lying. Commented Jun 29, 2021 at 9:14