hi, At every IRET it has to checked wheather it has interrupted the kernel space code or user space it can do that easily by examining the segment descriptor of interrupted code as it is there on stack, and why only timer interrupt will not check? it from the fact that i think is as the code(user or kernel space) gets interrupted by the I.H. it does its work and then exits then shall it be OK to wait for timer interrupt? which in 2.6 comes in 1ms but 10ms in 2.4, and its not also fair to return control to the interrupted process,as it might be case that some higher priority process is waiting for its share to come,yes if interrupted code is of kernel space then at IRET the control immidiatly returns to interrupted code without invoking scheduler,because kernel space code runs at higer privilage. Moreover as you specified its not that timer handler will invoke the scheduler always as it depends on need_resched flag. Prasanna --- "Dhiman, Gaurav" <Gaurav.Dhiman@ca.com> wrote: > > 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/ > > __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/