From owner-freebsd-arch@FreeBSD.ORG Mon Oct 22 05:21:01 2007 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C345B16A46E for ; Mon, 22 Oct 2007 05:21:01 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outW.internet-mail-service.net (outW.internet-mail-service.net [216.240.47.246]) by mx1.freebsd.org (Postfix) with ESMTP id ADCDB13C491 for ; Mon, 22 Oct 2007 05:21:01 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Sun, 21 Oct 2007 22:20:55 -0700 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 4FFBA126775; Sun, 21 Oct 2007 22:20:55 -0700 (PDT) Message-ID: <471C334D.9000605@elischer.org> Date: Sun, 21 Oct 2007 22:21:17 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: Ivan Voras References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-arch@freebsd.org Subject: Re: kthreads, kprocs? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Oct 2007 05:21:01 -0000 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.