Re: looking for info on kernel_thread

pwhiting@fury.ittc.ukans.edu
Mon, 12 Apr 1999 11:58:32 -0500


On Mon, Apr 12, 1999 at 12:20:29PM -0400, Jason A. Pfeil wrote:
> kernel_thread is used to create the kernel-level processes like kswapd,
> bdflush, and others. I would tend to think that it is preemptable like
> any other process, but I could be wrong. Feel free to correct me. :)

I am not sure if this is a valid test for preemptableness (word?), but
I started a kernel thread in init/main.c for spind:

void spind(void)
{
unsigned int spinner;
for(spinner=1;;spinner++)
if(spinner==0){
printk("wrapped\n");
}
}

Console showed a steady stream of "wrapped" and didn't make any other
progress.

I have the bottom half handler running as a kernel thread on another
box and it doesn't seem to have any trouble - but that chunk of code
is structured to sleep on a semaphore until the scheduler wakes it
up (ie the bh handler volunteers to give up the cpu when it figures
it has done enough - no preemption required.) I will eventually be
getting to the question of whether bottom halves can handle being
preempted. I kind of expected the box to crash but it ran under
heavy load for 48 hours. I would have to guess then that the semantics
of kernel_thread are such that I effectively "did nothing" by
stuffing the bottom half handler into its own thread.

learning slowly...

pete

ps. As a newbie to the list, let me know if this stuff is off topic
or should be posted elsewhere.

>
> On Mon, 12 Apr 1999 pwhiting@fury.ittc.ukans.edu wrote:
>
> > I am looking for some details about kernel threads.
> > I see kernel_thread defined in arch/whatever/kernel/,
> > but I am not totally clear on the details of how it
> > works. Specifically, how is it scheduled? Is it
> > preemptable? (my guess is no.)
> >
> > Is there a doc/book available with any details?
> >
> > thanks.
> >
> > pete
> >
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.rutgers.edu
> > Please read the FAQ at http://www.tux.org/lkml/
> >
>
> ----
> Jason A. Pfeil pfeil@cs.fsu.edu
> Network Administrator jpfeil@lsi.fsu.edu
> CASDL (850)644-8014; fax: (850)644-4952
> Learning Systems Institute University Center C-3519
> http://idl.fsu.edu Tallahassee, FL 32306-2540

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/