[erlang-questions] What are the "Most valuable libraries?"...and a few other questions
Wed May 18 09:02:36 CEST 2011
On 18 May 2011, at 02:25, Todd wrote:
> 3. How does one easily multithread an app? For instance, there's pmap in clojure and something similar in akka that lets you map a function across a list, and it allocates threads accordingly...
> literally something like: "pmap(myfun, mylist);"
The thing that makes Erlang a bit different here is that it is concurrency-oriented from the start. That is, you approach the concurrency model as a fundamental part of your functional design. From that perspective, the "multithreading" of an app might be exploiting in-process concurrency, or otherwise tweaking the "ideal" concurrency model for speed.
For this, there is no easy answer, but surprisingly often, an application using textbook Erlang techniques for its concurrency model will get very good utilisation of multicore hardware.
I gave a presentation in 2009 about how writing a generic "one-size-fits-all" pmap in Erlang is less than straightforward.
The good news is that it is not that hard to write a custom pmap that suits your particular needs, and this echoes the sentiments expressed in a recent thread about behaviours here on the list: learn the basic patterns, and their intrinsic semantics. Once you understand the mechanics, you can use behaviours where they are a good fit.
Ulf Wiger, CTO, Erlang Solutions, Ltd.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions