From mboxrd@z Thu Jan 1 00:00:00 1970 From: srrajesh1989@gmail.com (Rajesh S R) Date: Tue, 3 Jul 2012 21:31:59 +0530 Subject: Why can not processes switch in atomic context? In-Reply-To: References: Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Jul 3, 2012 7:55 PM, "Parmenides" 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. > 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? > 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? > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120703/7d9974e5/attachment.html