Hi, You are right to great extent. As far as I understand, in preemptive kernel the timer interrupt plays an important role. On every timer-interrupt, it checks if the time allotted to the current process is expired or not, in case it has not been expired yet, it does not switch the current running task. If it finds that the time allocated to current process has been expired, then it uses the bottom half functionality of kernel to make the calls to scheduler at some later time, when its bottom half handler will be called. Scheduler will save the context of current running process (does not matter if process is in user mode or in kernel mode, in both cases it will switch). Frankly speaking this is my perception, it might be wrong, if somebody finds it wrong, please correct it. Regards, Gaurav Dhiman. -----Original Message----- From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of amith Sent: Thursday, June 24, 2004 2:35 PM To: KERNEL Subject: Premptive vs non-premptive kernel. hi all, i have a basic doubt about premptive vs non - premptive kernels . In a kernel like 2.4 which is non-premptive a while(1) ; inside the code of my driver (for an example) would hang the system. But a premptive kernel like 2.6 ( i dont have it ) shouldnt hang the system, since it wud prempt and get to the next task . if what i asssumed above is right . when does the kernel get out of the context of the while loop (mentioned in the example) and switch to execute another task in a premptive kernel ? Normally on the next timer interrupt ? if , yes , then does a non-premptive kernel check whether it is executing in kernel context when a timer interrupt is triggered and based on whether it is in kernel or user context switch to the next task or not ? i couldnt see or rather find such a check being done in schedule() ,if one ever happens.. .. hope my question was clear . cheers, Amith -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/