[erlang-questions] Why are messages between processes copied?

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Thu Feb 23 11:40:27 CET 2012


On 2/22/12 11:22 PM, H. Diedrich wrote:
> Hi list,
>
> I had naively thought that Erlang would be sending process messages 
> around profiting from the fact that data is immutable and NOT copying 
> it. And really just send a 'pointer'.
>
> Why is that not so, it should be a huge gain from immutable data, 
> especially with bigger data. You don't have to copy, knowing that your 
> data is immutable.
Another interesting point: Modern architectures are slowly converging 
toward a world where the memory heap is not one big shared heap, but 
rather a number of non-coherent small batches. It is already in effect: 
You have 4+ cores, each with their own cache. But currently cache 
coherency in hardware makes it look like there is only one large shared 
heap.

As soon as you go distributed this is not the case anymore though. One 
of the hunches I have is that a copying system is simpler and is easier 
to adapt to newer hardware, but I am not very good at divination. So I 
would really be vary of embarking on a large project of rewrites to 
obtain a performance gain - especially right now. There also seem to be 
some work on hardware-based STM. That could probably benefit Erlang if 
you made it work a bit like an ETS table - with a little work.

-- 
Jesper Louis Andersen
   Erlang Solutions Ltd., Copenhagen, DK




More information about the erlang-questions mailing list