Thanks for correcting me on need_resched But please explain bit more about return path of any interrupt and how does it exactly checks if the control is returning to user or kernel mode. It would be nice if you can specify the file and location in file where we can find this interrupt returning code. Sorry Amith, for the wrong information I gave. I apologize for that. Thanks & Regards, Gaurav Dhiman -----Original Message----- From: Robert Love [mailto:rml@ximian.com] Sent: Friday, June 25, 2004 8:14 PM To: Dhiman, Gaurav Cc: amith; Gaurav Dhiman; KERNEL; Nagaraj S Subject: RE: Premptive vs non-premptive kernel. On Fri, 2004-06-25 at 16:49 +0530, Dhiman, Gaurav wrote: > need_resched is not something specific to a particular process and is > not a part of task_struct, its global to kernel and is set by timer > interrupt whenever the timer interrupt finds that the time allocated to > current process (represented by 'current' pointer) has expired. This is not true. need_resched is a flag in the process's thread_info struct. It is per- process, for performance reasons. > Your first question is my question also, How the returning code of any > interrupt finds whether the control is returning to user space or kernel > space? As far as I think, it must be checking if the return address > falls in kernel address range or in user address range. Can someone give > the detailed insight about this? Yes, this is basically what it does. The interrupts have to know whether to jump back to a kernel address or mode switch back to user- space, so there are different code paths. Robert Love -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/