Definition:

  • Used to protect access to the shared variable in a Critical Section to ensure that only one thread can modify it at a time
  • Protect a critical section by:
    • acquire() a lock
    • release() the lock
  • Implemented via Atomic Instructions
  • It requires busy waiting:
    • this lock is therefore called Spinlock
    • Unlike traditional locks (such as mutexes), a spinlock “spins” in a loop, repeatedly checking if the lock is available, rather than putting the thread to sleep.