How does shared memory vs message passing handle large data structures?

后端 未结 10 1248
南方客
南方客 2020-12-22 19:13

In looking at Go and Erlang\'s approach to concurrency, I noticed that they both rely on message passing.

This approach obviously alleviates the need for complex loc

10条回答
  •  有刺的猬
    2020-12-22 19:41

    In Erlang, all values are immutable - so there's no need to copy a message when it's sent between processes, as it cannot be modified anyway.

    In Go, message passing is by convention - there's nothing to prevent you sending someone a pointer over a channel, then modifying the data pointed to, only convention, so once again there's no need to copy the message.

提交回复
热议问题