Can you tell us, how the retuirn code of interrupt identifies if the control is returning to kernel space or user space. I mean how it comes to know that interrupt occurred in kernel space or user space. What exactly the returning code on any interrupt checks for this. Regards, Gaurav -----Original Message----- From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of Jan Hudec Sent: Friday, June 25, 2004 1:24 PM To: sajay@temenos.com Cc: kernelnewbies@nl.linux.org Subject: Re: Non Preemptive Kernel. On Fri, Jun 25, 2004 at 10:56:31 +0530, sajay@temenos.com wrote: > Hi, > > I have a doubt in the Non Preemptive Kernel. In the case of a Non > Preemptive Kernel, the Kernel Control Path cannot be preempted unless it > relinquishes the CPU Voluntarily. In this scenario, supposing a Timer > interrupt occurs, how does the timer Interrupt handler find out that a > Kernel Control Path is running and hence the process shouldn't be > preempted. Or is this handled by the schedule() function. It does not. IIRC schedule happens during return to userspace. Return to userspace does not happen if the interrupt interrupted kernel code. And note, that it really happens during EACH return to userspace (if need_resched is set), so if interrupt causes process to wake up, it's scheduled soon. ------------------------------------------------------------------------ ------- Jan 'Bulb' Hudec <bulb@ucw.cz> -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/