Advantages of a large number of threads cf other approaches?

Samuel Tardieu <>
Mon Feb 16 18:17:32 CET 2004


>>>>> "Jonathan" == jonathan  <> writes:

> * Internet servers - why not use asynchronous sockets running in a
> single thread?

Because you also need asynchronous file reading. If a file takes N ms
to load, then you will be blocking all the incoming requests. You will
end up implementing a scheduler by yourself, which is much more easily
achieved by using Erlang processes.

The situation is even worse if some of your requests need to access
external resources such as a database.

> * Simulations - why use an object per thread rather than a "classic"
> OO approach?

Same reason.

  Sam
-- 
Samuel Tardieu --  -- http://www.rfc1149.net/sam




More information about the erlang-questions mailing list