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 @tweets_so_fresh
Yes, and that’s fine. Linux scales quite well to tons of OS threads.
1 reply 1 retweet 0 likes -
Replying to @pcwalton
right. iiuc, it's really about how much memory you have to keep adding threads vs a cheaper things like a green thread/goroutine due to the difference in stack sizes.
1 reply 0 retweets 4 likes -
Replying to @tweets_so_fresh @pcwalton
at any rate, i think that's why i really like the cheap threading model + scheduler. it lets you get away with modeling lots of independent state without having to worry about memory pressure as much.
1 reply 0 retweets 3 likes -
Replying to @tweets_so_fresh
Stack sizes and green thread/OS thread are orthogonal concerns. You could have OS threads with very small stacks too. Small stacks are a property of GC, not of the threading model.
2 replies 0 retweets 7 likes -
Replying to @pcwalton
is it realistic to have OS threads with stack sizes as small as goroutines, which i think start at somewhere like 2-4KB?
1 reply 0 retweets 1 like -
Replying to @tweets_so_fresh
Yes, if you had a GC. The kernel stack size is 8kB, which is pretty small. Add 2kB for the userland size and you’re at 10kB. I don’t think the difference between 2kB and 10kB per thread matters for most apps, which often have to grow that size anyway.
5 replies 1 retweet 7 likes -
Replying to @pcwalton @tweets_so_fresh
Can you tell an OS thread to continue executing on a different stack than it had been on until then? (e.g., because it was too small and you've allocated a bigger one somewhere else)
1 reply 0 retweets 1 like
Yes. If you couldn’t, then green threads couldn’t work at all!
-
-
Thanks. 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.