[erlang-questions] What are the "Most valuable libraries?"...and a few other questions

Ulf Wiger ulf.wiger@REDACTED
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.

http://www.infoq.com/presentations/wiger-multicore-erlang

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.

BR,
Ulf W

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110518/4c1688f1/attachment.htm>


More information about the erlang-questions mailing list