From owner-freebsd-arch Mon Jan 15 14:17:37 2001 Delivered-To: freebsd-arch@freebsd.org Received: from meow.osd.bsdi.com (meow.osd.bsdi.com [204.216.28.88]) by hub.freebsd.org (Postfix) with ESMTP id A151C37B400 for ; Mon, 15 Jan 2001 14:17:16 -0800 (PST) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by meow.osd.bsdi.com (8.11.1/8.9.3) with ESMTP id f0FMFk194835; Mon, 15 Jan 2001 14:15:46 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20010114064356.Q7240@fw.wintelcom.net> Date: Mon, 15 Jan 2001 14:17:19 -0800 (PST) From: John Baldwin To: Alfred Perlstein Subject: RE: kthread_* api pretty rough Cc: arch@FreeBSD.org Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 14-Jan-01 Alfred Perlstein wrote: > I was pretty excited to see that we're using kthread_ stuff, however > actually using it is a bit more complex than I'd hoped. > > There's a couple of questions that I didn't see answered in the > manpage: > > 1) how to actually start the thread? kern/kern_idle.c and > kern/kern_intr.c both have somewhat different things that they > fiddle with in the proc struct returned by kthread_create. They are special. Just use kthread_create(). > 2) is simply calling kthread_exit(); enough to clean up the thread? Yes. Note that right now you need to have Giant before you call it. > 3) what are the state of the locks when the thread runs initially? > what about what state they need to be in before calling kthread_exit()? Nothing is held when it starts. Giant and only Giant should be held when calling exit. > 4) why we need to fiddle with the proc flags after starting a kthread > instead of having kthread_create do it for us. You don't. > 5) do i really want to be using kproc_start instead of kthread_create? > I just want to run a couple of threads to do some microbenchmarks > on some code I'm testing. kproc_start() is a function used in SYSINIT()'s to start up things like bufdaemon, etc. (Did you read the manpage? :) > 6) shouldn't the stuff to OR with the process flags be made into > an arg to kthread_create? Most users don't set anything in the process flags that I know of.. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message