bug:scheduling while atomic"和"bad: scheduling from the idle thread"

 

linux内核打印"BUG: scheduling while atomic"和"bad: scheduling from the idle thread"错误的时候,通常是在中断处理函数中调用了可以休眠的函数,如semaphore,mutex,sleep之类的可休眠的函数,而linux内核要求在中断处理的时候,不允许系统高度,不允许抢占,要等到中断处理完成才能做其他事情。因此,要充分考虑中断处理的时间,一定不能太久。

另外一个能产生此问题的是在idle进程里面,做了不该做的事情,现在Linux用于很多手持式设备,为了降低功耗,通常的作法是在idle进程里面降低CPU或RAM的频率、关闭一些设备等等,要保证这些动作的原子性才能确保不发生"bad: scheduling from the idle thread"这样的错误!

posted @ 2011-11-25 17:45  夏大王  阅读(2282)  评论(0编辑  收藏  举报