I’ve never understood the “async I/O is too complicated, why can’t we just use goroutines?” criticism of Rust. You can! They’re called threads, and they work great.
-
-
Replying to @pcwalton
The main advantage that goroutines have over os threads is that they're only switched off once they reached IO that blocks, or a specific blocking concurrency operation in the language. I don't think os threads offer the same capability....
1 reply 0 retweets 1 like -
Replying to @cronokirby
Yes, they do. The kernel is better at that than userland is.
1 reply 1 retweet 26 likes -
Replying to @pcwalton @cronokirby
Actually they aren’t, since the OS doesn’t know which registers are in use and thus has to save all of them. Goroutines are not preemptively context switched; so they actually know which registers they have to save when asking for a context switch.
2 replies 0 retweets 1 like -
Replying to @MattDenton @cronokirby
You don’t escape the kernel<->userland switch on I/O either way.
2 replies 0 retweets 0 likes -
Replying to @pcwalton @cronokirby
Sure but that’s not the only time you context switch.
1 reply 0 retweets 2 likes
And in exchange for a small stack, you lose the ability to quickly call FFI. We tried M:N threading in Rust and it was not worth it for this reason among others.
-
-
Do you have docs I can read about "this reason among others" ? I've lost track of them, but I'm sure I recall many such conversations on mailing lists or other places.
0 replies 0 retweets 0 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.