process pools?

Matthias Lang <>
Wed Oct 10 09:08:43 CEST 2001


 >         2) What is the best method to implement worker threads? i.e
 >            I'd like a pool of processes (one for each outbound

Thread pools are a solution to a particular problem C++ and Java
have: spawning new threads is fairly expensive in many (most? all?)
implementations, so you want to avoid doing that, especially when the
thread will then do a relatively small amount of work.

Erlang's processes are (much) more lightweight than the thread
implementations I've worked with, so you don't need to worry about
'spawn overhead' to the same degree.

The other reason I've seen thread pools used is in situations where
some expensive initialisation has to be done. It doesn't sound like
your program does this.

Matthias



More information about the erlang-questions mailing list