4 ms·
Erlang processes are not green threads. Green threads can share memory while Erlang processes cannot, they are strictly forbidden to do it. Also Erlang schedu
by romanoderoma 6y ago
Erlang processes are not green threads.
Green threads can share memory while Erlang processes cannot, they are strictly forbidden to do it.
Also Erlang scheduler is highly optimized to work as a soft real-time platform, so they never run for infinite amount of time, they never block and never (at least that's the goal) bring down the entire application, the worst thing that can happen is that everything slows down but it's still functional and responsive.
I don't know about Tokio.
- ibraheemdev 6y ago> Erlang processes are not green threads. Green threads can share memory while Erlang processes cannot, they are strictly forbidden to do it. So message passing is the only way to communicate between proccesses? I guess that makes sense with elixir being a fp language. This was not clear in the article: > Lunatic takes the same approach as Go, Erlang and the earlier implementation of Rust based on green threads.
- dnautics 6y ago> So message passing is the only way to communicate between proccesses? There are escape hatches. Obviously, you can do something really heavy like open a network port or open a file descriptor, but it also provides you with use ets, which is basically "really fast redis for intra-vm stuff" and you can transact over shared memory if you drop down to FFI.
- svrtknst 6y agoBasically only message passing. As another poited out, you can use FFI calls and Erlang Term Storage, possibly some other means to communicate, but the central feature is that each process has an ID, and then you send() a message to it. each process also has a receive() block where you essentially listen to everything that ends up in your mailbox and pattern match on it to take action.