Re:How to think about `async`/`await` in Rust
by jerf on Wednesday July 05, 2023 @03:31PM
(#36605868)
I've seen a lot of people who seem to think all blocking IO completely blocks the entire OS process.
A language + runtime like Go or Erlang doesn't so much have "blocking" or "non-blocking" IO as the terms simply not applying. I see them yielding far more confusion than understanding when people try to come from Node and apply them to such threaded runtimes.
But if you had to force a term on such a system, the better understanding is that everything in a large-number-of-threads language+runtime is non-blocking. Both terms yield incorrect understanding, but that one gets you closer to the truth.
(It may also help to think about the fact that both BEAM (Erlang/Elixir) and Go are immensely better at complicated IO than Node. Clearly they are not achieving this by blocking on every socket read attempt.)
A language + runtime like Go or Erlang doesn't so much have "blocking" or "non-blocking" IO as the terms simply not applying. I see them yielding far more confusion than understanding when people try to come from Node and apply them to such threaded runtimes.
But if you had to force a term on such a system, the better understanding is that everything in a large-number-of-threads language+runtime is non-blocking. Both terms yield incorrect understanding, but that one gets you closer to the truth.
(It may also help to think about the fact that both BEAM (Erlang/Elixir) and Go are immensely better at complicated IO than Node. Clearly they are not achieving this by blocking on every socket read attempt.)