On Mon, 2009-02-09 at 21:16 +0700, Mulyadi Santosa wrote:
> Hi...
> 
> On Mon, Feb 9, 2009 at 2:57 PM,  <sudheer.divaka...@wipro.com> wrote:
> > Hi All,
> > Please look at the following code from the article Sleeping in the Kernel
> >
> > http://www.linuxjournal.com/node/8144/print
> >
> > 1  set_current_state(TASK_INTERRUPTIBLE);
> > 2  spin_lock(&list_lock);
> > 3  if(list_empty(&list_head)) {
> > 4         spin_unlock(&list_lock);
> > 5         schedule();
> > 6         spin_lock(&list_lock);
> > 7  }
> > 8  set_current_state(TASK_RUNNING);
> > 9
> > 10 /* Rest of the code ... */
> > 11 spin_unlock(&list_lock);
> >
> >
> > Is there any chance for the process getting scheduled out of the
> run-queue
> > at Line# 2 (say the scheduler runs because of timer interrupt)??

I don't think schedule() will put you off the runqueue. And I don't see
the reason also. You didn't call sleep, neither are you doing any IO
request or anything else that can put you off the runqueue. Schedule()
is not supposed to put you off. But I might be wrong!

- Himanshu


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to