Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jul 2003 10:36:46 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        David Xu <davidxu@freebsd.org>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: libkse "wieght"
Message-ID:  <Pine.GSO.4.10.10307261025370.1253-100000@pcnet5.pcnet.com>
In-Reply-To: <200307262145.02854.davidxu@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 26 Jul 2003, David Xu wrote:

> 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 designe=
d to
> > be with libkse, say should I just create and throw away tens or hundred=
s of
> > threads in a small time or try to "recycle" the worker threads I alread=
y
> > created?=20
>=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=
 is=20
> still a good idea.

Libkse caches up to 100 threads for you, and throws away any more than
that to free().  There is still a bit of set up to do with a libkse
cached thread (makecontext(), add the thread to the run queue, etc),
but it should be faster than creating a thread from scratch.

I think you would have to modify the library to not cache threads
(set MAX_CACHED_THREADS to 0 in lipthread/thread/thr_kern.c) in
order to really benchmark the difference between the library
caching threads and not caching threads.

--=20
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10307261025370.1253-100000>