libkse "wieght"
David Xu
davidxu at FreeBSD.org
Sat Jul 26 06:42:01 PDT 2003
On Saturday 26 July 2003 21:00, Petri Helenius wrote:
> First of all, I´m 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?
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
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´m 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,
thread is still better then select/poll.
> I´m 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´t
> tested the creation/termination stuff yet.
>
> Pete
>
> _______________________________________________
> freebsd-threads at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-threads
> To unsubscribe, send any mail to "freebsd-threads-unsubscribe at freebsd.org"
More information about the freebsd-threads
mailing list