为什么中断处理程序(ISR)无法入睡? [英] Why interrupt handlers (ISRs) cannot sleep?

查看:144
本文介绍了为什么中断处理程序(ISR)无法入睡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑为什么中断处理程序无法入睡?对于相同的问题,我有2个意见:-

I am very confuse to get why interrupt handler can't sleep? i got 2 views for the same issue:-

  1. 中断处理程序不是可调度的吗?因为它没有task_struct.

  1. Interrupt Handler is not schedulable? Because it has no task_struct.

如果处理程序处于睡眠状态,则系统可能会挂起,因为系统时钟中断被屏蔽并且无法安排睡眠过程.

if the handler sleeps, then the system may hang because the system clock interrupt is masked and incapable of scheduling the sleeping process.

中断处理程序是否可调度,
但是较低优先级的系统时钟中断
被这些优先级较高的中断所掩盖

他们无法安排时间?

Are interrupt handlers schedule-able,
but while the lower priority system clock interrupt
is masked by these higher priority interrupts
,
they cannot be scheduled?

请给我一个很好的例子.

Please give me a good example for the same.

推荐答案

您无法在Linux的中断处理程序中入睡,因为它们没有执行线程的支持.换句话说,它们不是可调度的实体.

You can't sleep in interrupt handlers in Linux because they are not backed by a thread of execution. In other words, they aren't schedulable entities.

大多数系统将中断处理分为两半,通常称为上半部分和下半部分.上半部分运行非常快,中断发生时(实际上以运行方式)中断发生时正在执行的一切—上半部分本身没有线程.因此,上半部分无法入睡,因为没有什么事情可以安排在睡眠结束后重新安排.

Most systems break interrupt processing into two halves, commonly called a top half and a bottom half. The top half runs very quickly, interrupting (and in fact running as) whatever was executing when the interrupt occurred-the top half has no thread itself. Consequently, the top half is unable to sleep, as there isn't anything to schedule back into when the sleep completes.

来自 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆