Synchronisation : Spin lock and dead lock


#1

What is difference between spin lock and dead lock?


#2

Deadlock is a kind of mutual waiting between processes for resources in the system .This happens because these resources are non-shareable .A process can acquire a particular resource in a non shareable environment only if that resource is free.
On the other hand the spin lock is based on the concept of threads.The thread trying to acquire this lock has to wait in a loop (like spinning) while repeatedly checking for the lock if it is available or not.This is a kind of busy waiting as the thread is not performing any useful task.