adspace
Whether we can use semaphore or mutex or spinlock in interrupt context in linux kernel?
Answer Posted / Parmanand Singh
In Linux Kernel, neither semaphores nor mutexes nor spinlocks should be used directly within an interrupt handler. This is because the preempt_disable() function is typically called when entering an interrupt handler to prevent the scheduler from preempting the current task. However, if preempt_disable() is called, it disables all kernel preemption including mutexes and semaphores. Spinlocks can be used in interrupt handlers because they do not involve a context switch and thus no mutex or semaphore would be affected.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is your experience with qa engineering?
What software languages have you used to design, develop, and debug software application interfaces?
Would you call yourself a craftsman (craftsperson) and what does that word mean to you?
Tell me about some of your hobby projects that you've written in your off time.
Are you still writing code? Do you love it?