DEV Community

loading...

Discussion on: Writing Rust the Elixir way

Collapse
kajmagnus profile image
KajMagnus

Personally I'm glad to see Erlang and Elexir ideas happening in Rust too — and even better — the within-processes-only crashes for example.

Using green threads for parallel compute doesn't make sense as the OS can handle only a specific amount of work.

That sounds weird to me. If you look carefully in the article above: 2 000 real threads, Mac OS crash. But 10 x more lightweight threads: Works fine. That can be real-life useful when designing a web framework for example.

Collapse
benwtrent profile image
Benjamin Trent

That sounds weird to me. If you look carefully in the article above: 2 000 real threads, Mac OS crash

2,000 real threads doesn't make sense for parallel compute. i9 intel processors don't have 2,000 threads.

Now, 2,000+ "threads" or better yet async code DOES make sense for I/O. Because there is not real "work" being done.

But if you are doing compute bound work, 2k+ CPU threads makes no sense on a personal computer.

But 10 x more lightweight threads: Works fine. That can be real-life useful when designing a web framework for example.

100%, if your work is I/O bound, it is exceedingly useful. That is the point of my comment.

The example of the TCP echo server is a great example of I/O bound work.

Thread Thread
kajmagnus profile image
KajMagnus

Ok, thanks for replying. Agreed that 2k CPU threads sounds a bit weird