Does Spinlock Disable Interrupts?

Does Spinlock Disable Interrupts?

The most basic primitive for locking is spinlock. ... It will disable interrupts _locally_, but the spinlock itself will guarantee the global lock, so it will guarantee that there is only one thread-of-control within the region(s) protected by that lock.

Can spinlock be interrupted?

There are variants of the spinlock functions that will disable interrupts for you (we'll see them in the next section). However, a complete discussion of interrupts must wait until Chapter 10. The last important rule for spinlock usage is that spinlocks must always be held for the minimum time possible.

Does spinlock disable preemption?

spinlock automatically disables preemption, which avoids deadlock caused by interrupts. when data is shared with interrupt handler, before holding spinlock we must disable interrupts. when data is shared with bottom halves, before holding spinlock we must disable bottom halves.

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.