[lkml]   [2005]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: when or where can the case occur in "linux kernel development " about "kernel preemption"?
linux-os (Dick Johnson) wrote:
> On Sat, 27 Aug 2005, Sat. wrote:
>>2005/8/27, Christopher Friesen <>:
>>>Sat. wrote:
>>>>the case about kernel preemption as follow :
>>>>the book said "when a process that has a higher priority than the
>>>>currenty running process is awakened ".
>>>>but I can think about when such case can occur , could you give me an example ?
>>>There may be others, but one common case is when a hardware interrupt
>>>causes the higher priority process to become runnable. Some examples of
>>>this would be a network packet arriving, or the expiry of a hardware timer.
>>unfortunately, I cannot agree with you , normally ,when the kernel
>>runs in interrupt context , the schedule() should not be invoked
>>------my views .
>>then,could anyone give me a definite example about network like above
>>or anything else to eluminate this , ok?
>>thanks !
> Schedule is never executed from an interrupt, BUT, there may be
> kernel threads or even user tasks that are sleeping, waiting
> to be awakened when some preliminary interrupt processing has
> occurred. The interrupt code may execute one of the wake-up calls
> which will cause the target to be put into the run queue as soon
> as possible.
Actually, this is not completly true. The kernel sets a flag while
handling interrupts that says it is within an interrupt. This flag is
cleared on the way out of the interrupt but prior to the return from
interrupt (rfi) instruction. Between this flag clearing and the rfi,
there is a check made to see if the kernel is preemptable and, if so, if
it is desired (i.e. something more important should run NOW). If both
of these are true, schedule is called to do the context switch. So,
schedule IS called from within the interrupt, but NOT within the area
the kernel flags as being in an interrupt which is a subset of the
actual interrupt.
George Anzinger
HRT (High-res-timers):
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-08-29 21:26    [W:0.050 / U:11.916 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site