Search⌘ K

Too Much Spinning: What Now?

Explore the problem of excessive spinning in locks during concurrency when multiple threads compete for a lock. Understand why simple hardware locks may waste CPU time and learn how operating system support can help develop more efficient locking mechanisms to reduce wasted processing cycles.

We'll cover the following...

The simple hardware-based locks are simple (only a few lines of code) and they work (you could even prove that if you’d like to, by writing some code), which are two excellent properties of any system or code. However, in some cases, these solutions can be quite inefficient. Imagine you are running two threads on a single processor. Now imagine that one thread (thread 0) is in a critical section and thus has a lock held, and unfortunately gets interrupted. The ...