...

/

A Simple Approach: Just Yield, Baby

A Simple Approach: Just Yield, Baby

This lesson discusses the use of yield to avoid spinning.

We'll cover the following...

Hardware support got us pretty far: working locks, and even (as with the case of the ticket lock) fairness in lock acquisition. However, we still have a problem: what to do when a context switch occurs in a critical section, and threads start to spin endlessly, waiting for the interrupted (lock-holding) thread to be run again?

Lock with test-and-set and yield

Our first try is a simple and friendly approach: when you are going to ...

Access this course and 1400+ top-rated courses and projects.