From owner-freebsd-threads@FreeBSD.ORG Sat Jul 26 06:42:00 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EAF7C37B401; Sat, 26 Jul 2003 06:42:00 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 920EC43FA3; Sat, 26 Jul 2003 06:42:00 -0700 (PDT) (envelope-from davidxu@FreeBSD.org) Received: from localhost (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h6QDfwUp062787; Sat, 26 Jul 2003 06:41:59 -0700 (PDT) (envelope-from davidxu@FreeBSD.org) From: David Xu Organization: Viatech To: "Petri Helenius" , Date: Sat, 26 Jul 2003 21:45:02 +0800 User-Agent: KMail/1.5.2 References: <069c01c35375$e9352880$812a40c1@PETEX31> In-Reply-To: <069c01c35375$e9352880$812a40c1@PETEX31> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200307262145.02854.davidxu@FreeBSD.org> Subject: Re: libkse "wieght" X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jul 2003 13:42:01 -0000 On Saturday 26 July 2003 21:00, Petri Helenius wrote: > First of all, I=B4m very happy with the libkse since a few weeks ago, > scheduling and signals seem to work for me and the application runs > smoother than ever, although with only a handful of threads. > > I was wondering how "expensive" thread creation and termination designed = to > be with libkse, say should I just create and throw away tens or hundreds = of > threads in a small time or try to "recycle" the worker threads I already > created?=20 With newest libkse source code, I can create 5000 threads and then pthread_join them in 0.6 seconds on my PIII 1Ghz machine. Although it is cheap enough to create thread and throw it away, but caching some threads i= s=20 still a good idea. > Most threads will be either waiting on network input/output,, > condvar to flip or a sleep to expire. I would expect to have maximum of > 5-10 threads executing at any time but I=B4m wondering if the traditional > "large poll/select" approach is superior to creating, say, 500 threads? > It depends on application, because poll/select on disk file has no effect, if you want to increase concurrent I/O for disk file, if you don't use AIO= ,=20 thread is still better then select/poll. > I=B4m not expecting you to design my app for me but just give insight of = how > expensive I should the thread maintenance and switching operations to be > with libkse. By my previous experience with libkse, switching between > threads is lightweight enough not to cause performance issues. I haven=B4t > tested the creation/termination stuff yet. > > Pete > > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org"