<p><br>
On Jul 3, 2012 7:55 PM, "Parmenides" <<a href="mailto:mobile.parmenides@gmail.com">mobile.parmenides@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> It is said that kernel can not be preempted in interrupt context<br>
> and when it is in a critical section protected by a spin lock.<br>
><br>
> 1. For the spinlock case, it is easy to get if preemption is allowed<br>
> in critical section, the purpose of protection provided by spinlock<br>
> can not be achieved readily.<br>
><br>
I don't know about Linux kernel. But the very prime purpose of a spin lock is to synchronize in the presence of pre-emption. Are u talking about implementing spin lock in the absence of an atomic hardware instruction?</p>
<p>> 2. For the interrupt context case, I think when processing interrupt,<br>
> kernel can be preempted in principle. But, this really increases the<br>
> interrupt processing time which further cause longer response time and<br>
> data missing in device. Except that, is there any other reasons?<br>
><br>
> 3. Kernel is responsible for prohibiiting passive process switches,<br>
> namely preemption, in the above cases. But, It seems that it does not<br>
> take care of active process swtiches, namely yield. For example, some<br>
> code in a critical section protected by a spinlock can invoke<br>
> schedule() to switch process passively. Is this the case?<br>
><br>
> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</p>