user2699113
user2699113

Reputation: 4509

Priorities in kernel space

My question concerns kernel space programming. Let's assume that we have 2 handlers for: - hardware interrupt - /proc file

Is it possible while hardware interrupt handler is executing to interrupt it by /proc handler because user written something into /proc file?

What are the priorities of both handlers in such case?

Upvotes: 1

Views: 274

Answers (1)

tian_yufeng
tian_yufeng

Reputation: 1826

Let me try to answer your questions or make your question clearer.

Hardware handler is running in interrupt context. Of course, one hardware handler is divided to two parts: a smaller but critical one which is executed in interrupt context, while the other one is bigger one which can be defered and is executed in soft-irq context.

While "the /proc file handler"(you called it) is executed in user-process context. When you access /proc file, the handler is triggered and executed.

In hardware interrupt context, sometime, the local hardware interrupt is disabled. In the soft-irq context, sometime, the BH is disable or kernel preempt is disable. That is to say, in interrupt context, sometime, the schedule does not happen. So based on this, I can say that priority of the "/proc file handler" is lower than the "interrupt handler".

As for the question "Is it possible while hardware interrupt handler is executing to interrupt it by /proc handler because user written something into /proc file?". In current Kernel, it's impossible. I think it does not worth hacking if you want to, because it does not make any sense.

Upvotes: 1

Related Questions