3 ms·
Me too! I don’t know Erlang enough, but Golang channels accept anything, including mutable data, file descriptors etc. If you want to send to different machines
by klabb3 4y ago
Me too! I don’t know Erlang enough, but Golang channels accept anything, including mutable data, file descriptors etc. If you want to send to different machines you need glue and refactoring in order to get some similar behavior, since channels are in-process only.
My understanding is that Erlang require messages to be self-contained/immutable (even serializable?) which would make it possible to simply move an actor (process) to a different machine, or even multiple machines? If you know Erlang, please fact check!
- weatherlight 4y agoMessages between Erlang processes are simply valid Erlang terms. That is, they can be lists, tuples, integers, atoms, other pids (process identifiiers), strings, and so on. However, Erlang and Elixir's AST is also composed of valid Erlang terms, so as I understand. you can send entire Erlang/Elixir programs as messages. To answer your question, Yes, it is possible, but there is no "Move process to node" call. However, if the process is built with a feature for migration, you can certainly do it by sending the function of the process and its state to another node and arrange for a spawn there. To get the identity of the process right, you will need to use either the global process registry or gproc, as the process will change pid. There are other considerations as well: The process might be using an ETS table whose data are not present on the other node, or it may have stored stuff in the process dictionary (state from the random module comes to mind)