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


Please Help Members By Posting Answers For Below Questions

What is your experience with qa engineering?

927


What software languages have you used to design, develop, and debug software application interfaces?

944


Would you call yourself a craftsman (craftsperson) and what does that word mean to you?

928


Tell me about some of your hobby projects that you've written in your off time.

974


Are you still writing code? Do you love it?

863