[OpenSIPS-Devel] RFC: new opensips design
Dan Pascu
dan at ag-projects.com
Sun Nov 9 05:01:02 CET 2008
On Friday 07 November 2008, Stefan Sayer wrote:
> nowadays, thread creation has become so cheap (in comparision...), that
> synchronous MT (create one thread per task) is definitely an option I
> would say.
I would say the contrary. Linux, which is the most likely platform to be
used, uses the same system call to create a thread or a process (in fact
threads are just a particular case of a process in linux). Thus the myth
that threads are "lightweight" compared to processes is just that (at
least in linux' case). Also as I mentioned before, it's not just thread
creation that counts, it's context switching as well. I've seen
benchmarks (unfortunately I no longer recall the URL), where with a few
thousands of threads, context switching was using more CPU than the
application itself.
I've also seen benchmarks (again I don't remember the URL), where an async
based web server implementation would scale linearly with the number of
requests, while the equivalent multithreaded version which attempted to
create a thread per request was going down after a certain number of
requests per second exactly because of the context switching penalty
mentioned before.
--
Dan
More information about the Devel
mailing list