-->

What is spin lock?

- In a loop a thread waits simply ('spins') checks repeatedly until the lock becomes available.

- This type of lock is a spin lock. The lock is a kind of busy waiting, as the threads remains active by not performing a useful task.

- The spin locks are to release explicitly, although some locks are released automatically when the tread blocks.

- They are efficient as they are blocked only for a short periods.

- They can be wasteful if they are held for a longer duration.

- By implementing the spin locks correctly as they offer challenges as the programmers must take into account the possibility of simultaneous access to the lock, which could cause race conditions.