Abstract


  • Also known as Spinning
  • A Process (进程) or Thread repeatedly checks a condition without giving up the CPU until the condition is satisfied

Simple and efficient synchronisation mechanism

Shines when condition is expected to be met very quickly. Like Process (进程) waiting for input from the keyboard.

Attention

Can waste Clock Cycle if the condition is not met quickly. For example, a lot of CPU cycles is wasted when a process or thread tries to have a Spinlock on an IO Device, but another process or thread is using the Device Controller to retrieves a large amount of data from IO device.

Spinlock