[Libevent-users] http: libevent vs many threads
William Ahern
william at 25thandClement.com
Sat Apr 19 00:23:19 EDT 2008
On Fri, Apr 18, 2008 at 10:36:53PM +0200, Cezary Rzewuski wrote:
> Thank you for Your suggestions. I've just finished the implementation.
> I used the approach of libevent as HTTP server and threads working
> on downloaded content (they are performing some statistical computation on
> downloaded javascripts). It looks to work efficiently.
>
> It's probably not the right group, but you says that switching between
> threads
> is expensive. However, I've read somewhere (it was probably "Advanced linux
> programming" by Alex Samuel) that creating a new thread is nearly as fast as
> calling a function. Does it mean, that switching between threads is
> slower than
> creating a new thread?
Creating a new thread is almost certainly not as fast as calling a function.
Maybe, I suppose, as fast calling into the kernel; author's point being that
Linux can quickly allocate and setup the task structures.
But this sounds like one of those things you should test yourself. I'm not
quite sure what the benchmark would look like. Try Usenet:
comp.unix.programmer, or comp.programming.threads.
More information about the Libevent-users
mailing list