Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Oct 2007 22:21:17 -0700
From:      Julian Elischer <julian@elischer.org>
To:        Ivan Voras <ivoras@freebsd.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: kthreads, kprocs?
Message-ID:  <471C334D.9000605@elischer.org>
In-Reply-To: <fffh3t$2ac$1@ger.gmane.org>
References:  <fffh3t$2ac$1@ger.gmane.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Ivan Voras wrote:
> Hi,
> 
> I've seen the cvs notice about kthread renaming to kprocs, and I wonder
> why - what's the need for "proper" kthreads and how will it be different
> from current implementation of kprocs? Will it mimic userland to form a
> "hierarchy": processes have threads? Why, since all the kernel is a
> single context wrt memory protection?
> 


well threads are lighter weight to create, and use less resources.
you also increase context on the allprocs list lock (have you seen
how many system processes ther eare these days?).

they were processes when we didn't have threads and I'm kind of annoyed I didn't 
fix that when I made threads exist.

SOME kernel processes NEED to be processes. The AIO helpers come to mind immediatly,
but MOST don't..

here's part of a kdb 'ps' on my system right now..

   10     0     0     0  RL      CPU 0               [swi4: clock sio]
    1     0     1     0  SLs     wait     0xc5ef5000 [init]
    0     0     0     0  RLs     (threaded)          swapper
100013                   CanRun                      [idle: cpu0]
100012                   CanRun                      [idle: cpu1]
100011                   CanRun                      [idle: cpu2]
100010                   Run     CPU 3               [idle: cpu3]
     0                   I                           [swapper]

notice that the idle threads are just threads hanging off proc 0
as is the actual swapper thread.
In the final version I think I might keep a separate 
'Idle' process with NCPU threads but that's purely an aesthetic thing.

unfortunatly, ps and top don't show the thread names yet but they will.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?471C334D.9000605>