Re: Premptive vs non-premptive kernel.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 24, 2004 at 14:34:35 +0530, amith wrote:
> 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) ; 

Yes.

> 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 .

It depends. Even if the kernel is compiled with preemption (which is
does NOT have to be), the preemption only works in process context and
only if no spinlocks are held. So the code would still hang the system
if you call it in interrupt context or with a spinlock held.

> 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

I think so.

> 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.. ..

schedule() does not do the check. After all, it's called rather often in
kernel context (explicitely). So the check must be somewhere in the
timer interrupt stuff.

> hope my question was clear .
-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux