Some of the important difference between Spin Lock and Mutex are:
Spinlock | Mutex |
Spinlock is a busy waiting lock, that is process or thread is not put to sleep that is Process Descriptor(PD) or Thread Descriptor(TD) is not added to wait queue. | Mutex is a sleeping lock that is process or thread is put to sleep that is Process Descriptor(PD) or Thread Descriptor(TD) is added to wait queue. |
There is no context switching involved | Context switching is involved. |
This is useful for small critical section, else wastes CPU cycle. | This is useful for long critical sections otherwise a frequent context switching adds overhead. |
Preemption is disabled | Prremption is enabled. |
Categories: Operating system (OS)
Leave a Reply