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

后端 未结 10 1297
南方客
南方客 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:50

    What is a large data structure?

    One persons large is another persons small.

    Last week I talked to two people - one person was making embedded devices he used the word "large" - I asked him what it meant - he say over 256 KBytes - later in the same week a guy was talking about media distribution - he used the word "large" I asked him what he meant - he thought for a bit and said "won't fit on one machine" say 20-100 TBytes

    In Erlang terms "large" could mean "won't fit into RAM" - so with 4 GBytes of RAM data structures > 100 MBytes might be considered large - copying a 500 MBytes data structure might be a problem. Copying small data structures (say < 10 MBytes) is never a problem in Erlang.

    Really large data structures (i.e. ones that won't fit on one machine) have to be copied and "striped" over several machines.

    So I guess you have the following:

    Small data structures are no problem - since they are small data processing times are fast, copying is fast and so on (just because they are small)

    Big data structures are a problem - because they don't fit on one machine - so copying is essential.

提交回复
热议问题