On Tue, Jul 3, 2012 at 9:24 AM, Parmenides <mobile.parmenides@xxxxxxxxx> wrote:
Hi,
It is said that kernel can not be preempted in interrupt context
and when it is in a critical section protected by a spin lock.
1. For the spinlock case, it is easy to get if preemption is allowed
in critical section, the purpose of protection provided by spinlock
can not be achieved readily.
2. For the interrupt context case, I think when processing interrupt,
kernel can be preempted in principle. But, this really increases the
interrupt processing time which further cause longer response time and
data missing in device. Except that, is there any other reasons?
3. Kernel is responsible for prohibiiting passive process switches,
namely preemption, in the above cases. But, It seems that it does not
take care of active process swtiches, namely yield. For example, some
code in a critical section protected by a spinlock can invoke
schedule() to switch process passively. Is this the case?
Well one should not hold a spinlock and call schedule(). If at all you want to yield,
release the spinlock and yield. Hope that answers your question.
release the spinlock and yield. Hope that answers your question.
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies