What is spin lock?
A spin lock is a lock where the thread simply waits in a loop (“spins”) repeatedly checking until the lock becomes available. As the thread remains active but isn’t performing a useful task, the use of such a lock is a kind of busy waiting. Once acquired, spin locks will usually be held until they are explicitly released, although in some implementations they may be automatically released if the thread blocks, or “goes to sleep”.