Optimal multithread model
christophe at meessen.net
Tue Mar 16 15:40:46 CET 2010
Regarding the threads vs. processes discussion I see a use case which
hasn't been discussed yet.
Consider the C10K application with many cold links and a context (i.e.
authentication, data structures, ...) associated to each connection.
With threads we can easily set up a pool of worker threads that easily
and efficiently pick up the context associated to the connection
becoming active. I don't see how an equivalent model can be efficiently
implemented with processes.
I would prefer it was possible to do it with processes because they have
the benefit of a separate memory space which is much better for
security and robustness. But I couldn't find a way to do it as easily
and efficiently as with threads.
More information about the libev