The actor model: Why is Erlang/OTP special? Could you use another language?

后端 未结 6 1761
失恋的感觉
失恋的感觉 2021-01-29 20:23

I\'ve been looking into learning Erlang/OTP, and as a result, have been reading (okay, skimming) about the actor model.

From what I understand, the actor model is simply

6条回答
  •  一生所求
    2021-01-29 21:09

    The C++ code does not deal with fairness, isolation, fault detection or distribution which are all things which Erlang brings as part of its actor model.

    • No actor is allowed to starve any other actor (fairness)
    • If one actor crashes, it should only affect that actor (isolation)
    • If one actor crashes, other actors should be able to detect and react to that crash (fault detection)
    • Actors should be able to communicate over a network as if they were on the same machine (distribution)

    Also the beam SMP emulator brings JIT scheduling of the actors, moving them to the core which is at the moment the one with least utilization and also hibernates the threads on certain cores if they are no longer needed.

    In addition all the libraries and tools written in Erlang can assume that this is the way the world works and be designed accordingly.

    These things are not impossible to do in C++, but they get increasingly hard if you add the fact that Erlang works on almost all of the major hw and os configurations.

    edit: Just found a description by Ulf Wiger about what he sees erlang style concurrency as.

提交回复
热议问题