1. Spinlocks are used in ISRs and in SMP systems [symmetric multi core processor].
2. Can be made atomic in context.
3. Implemented by using a bit in integer and set or test of the bit.
4. While using spinlocks disabling the interrupts avoid deadlocks.
5. Disabling interrupts avoids pre-emption from ISR and higher priority tasks.
6. Spin locks with interrupts disabled are slower as the processor never goes into sleep and waits for spinlock object to complete and keeps the interrupts pending or lost.
7. Let’s take case of protecting structure that is updated in only process context and not on interrupts in this case spin_lock() is a benefit
Ex) spin_unlock_bh other available spin_lock(). Spin_unlock(), spin_unlock_saveirq(), spin_lock_irq(),spin_unlock_irqrestore
No comments:
Post a Comment