3 ms·
the conclusion of the article specifies goroutines as solving this problem. Erlang processes are the same. Here's a simple test for checking this: does the lan
by findjashua 11y ago
the conclusion of the article specifies goroutines as solving this problem. Erlang processes are the same.
Here's a simple test for checking this: does the language provide a green-thread/coroutine abstraction, or do you work at the OS thread level:
In JS, C#, JVM languages, Python etc you work at the OS thread, so async operations need to be handled differently from synchronous one.
Elixir/Erlang, Go, Haskell etc provide green thread abstractions, so your green thread can block on an async operation without blocking the OS thread.
Elixir/Erlang is especially nice since each process (green thread) is completely isolated. This has multiple advantages:
i) when an erlang process (green thread) crashes, it doesn't take the other green threads on the OS thread down with it.
ii) garbage collection is per erlang process, not for the entire run-time. So the garbage collector doesn't halt everything when it runs. This makes it a really solid option for soft real-time systems
iii) stack trace is also per green thread, so you only see execution steps for the particular green thread in the stack trace, this makes debugging much much easier
iv) erlang processes can communicate with processes on other machines, this makes it a really good option for dist systems
The only drawback is that it's slow for cpu bound stuff, so i'd avoid it for anything that's computation intensive
disclaimer: elixir fanboy