public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* when or where can the case occur in "linux kernel development " about "kernel preemption"?
@ 2005-08-26 16:20 Sat.
  2005-08-26 16:40 ` Christopher Friesen
  0 siblings, 1 reply; 6+ messages in thread
From: Sat. @ 2005-08-26 16:20 UTC (permalink / raw)
  To: linux-kernel

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 ?

thanks  and any help will be appreciated!



-- 
Sat.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: when or where can the case occur in "linux kernel development " about "kernel preemption"?
  2005-08-26 16:20 when or where can the case occur in "linux kernel development " about "kernel preemption"? Sat.
@ 2005-08-26 16:40 ` Christopher Friesen
  2005-08-27 15:57   ` Sat.
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Friesen @ 2005-08-26 16:40 UTC (permalink / raw)
  To: Sat.; +Cc: linux-kernel

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.

Chris

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: when or where can the case occur in "linux kernel development " about "kernel preemption"?
  2005-08-26 16:40 ` Christopher Friesen
@ 2005-08-27 15:57   ` Sat.
  2005-08-28  7:05     ` Gaurav Dhiman
  2005-08-29 11:46     ` linux-os (Dick Johnson)
  0 siblings, 2 replies; 6+ messages in thread
From: Sat. @ 2005-08-27 15:57 UTC (permalink / raw)
  To: Christopher Friesen; +Cc: linux-kernel

2005/8/27, Christopher Friesen <cfriesen@nortel.com>:
> 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.
> 
> Chris
> 

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 !

-- 
Sat.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: when or where can the case occur in "linux kernel development " about "kernel preemption"?
  2005-08-27 15:57   ` Sat.
@ 2005-08-28  7:05     ` Gaurav Dhiman
  2005-08-29 11:46     ` linux-os (Dick Johnson)
  1 sibling, 0 replies; 6+ messages in thread
From: Gaurav Dhiman @ 2005-08-28  7:05 UTC (permalink / raw)
  To: Sat.; +Cc: Christopher Friesen, linux-kernel

On 8/27/05, Sat. <walking.to.remember@gmail.com> wrote:
> 2005/8/27, Christopher Friesen <cfriesen@nortel.com>:
> > 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.
> >
> > Chris
> >
> 
> unfortunately, I cannot agree with you , normally ,when the kernel
> runs in interrupt context , the schedule() should not be invoked
> ------my views .
> 

Its not actually the interrupt handler which calls the schedule()
function, rather interrupt handler just perform the minimal task, like
copying the data from network card buffer to kernel buffer in case of
packet arriving on system. Its the other function which actually
interrut handler schedules for later invocation and this later
invocation is done in process context and so the function scheduled
for later invocation can wake the waiting processes and can call
schedule() function if needed.

I hope I am not wrong ;-)
-Gaurav

> then,could anyone  give me a definite example about network like above
> or anything else to eluminate  this , ok?
> 
> thanks !
> 
> --
> Sat.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: when or where can the case occur in "linux kernel development " about "kernel preemption"?
  2005-08-27 15:57   ` Sat.
  2005-08-28  7:05     ` Gaurav Dhiman
@ 2005-08-29 11:46     ` linux-os (Dick Johnson)
  2005-08-29 17:54       ` George Anzinger
  1 sibling, 1 reply; 6+ messages in thread
From: linux-os (Dick Johnson) @ 2005-08-29 11:46 UTC (permalink / raw)
  To: Sat.; +Cc: Christopher Friesen, linux-kernel


On Sat, 27 Aug 2005, Sat. wrote:

> 2005/8/27, Christopher Friesen <cfriesen@nortel.com>:
>> 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.
>>
>> Chris
>>
>
> 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 !
>
> --
> Sat.

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.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.12.5 on an i686 machine (5537.79 BogoMips).
Warning : 98.36% of all statistics are fiction.
.
I apologize for the following. I tried to kill it with the above dot :

****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: when or where can the case occur in "linux kernel development " about "kernel preemption"?
  2005-08-29 11:46     ` linux-os (Dick Johnson)
@ 2005-08-29 17:54       ` George Anzinger
  0 siblings, 0 replies; 6+ messages in thread
From: George Anzinger @ 2005-08-29 17:54 UTC (permalink / raw)
  To: linux-os (Dick Johnson); +Cc: Sat., Christopher Friesen, linux-kernel

linux-os (Dick Johnson) wrote:
> On Sat, 27 Aug 2005, Sat. wrote:
> 
> 
>>2005/8/27, Christopher Friesen <cfriesen@nortel.com>:
>>
>>>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.
>>>
>>>Chris
>>>
>>
>>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 !
>>
>>--
> 
> 
>>Sat.
> 
> 
> 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   george@mvista.com
HRT (High-res-timers):  http://sourceforge.net/projects/high-res-timers/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-08-29 19:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-26 16:20 when or where can the case occur in "linux kernel development " about "kernel preemption"? Sat.
2005-08-26 16:40 ` Christopher Friesen
2005-08-27 15:57   ` Sat.
2005-08-28  7:05     ` Gaurav Dhiman
2005-08-29 11:46     ` linux-os (Dick Johnson)
2005-08-29 17:54       ` George Anzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox