News for hackers. Stuff that matters.
Re:Threads and Goroutines by ridiculous_fish on Monday July 24, 2023 @09:37PM (#36856759)
Go can multiplex goroutines into a single syscall invocation. Two goroutines waiting on distinct file descriptors will use a single epoll (or similar) syscall. However not all syscalls can be multiplexed this way.

IMO this partially undermines the "Go doesn't have colored functions" claim. 1k goroutines calling read is fine, because read is multiplexed, but 1k goroutines calling stat will be painful, because you get 1k kernel threads. Go's "red functions" are those which require a dedicated kernel thread.

Re:Threads and Goroutines by insanitybit on Monday July 24, 2023 @11:47PM (#36857626)
I think it just undermines "colorless functions are good", not that go's functions are colored - they aren't. The problem is that "colors" (ie: "this is async") are helpful to the caller, they let them know which context they should be in when they perform that work.
Re:Threads and Goroutines by thumbuddy on Tuesday July 25, 2023 @06:45AM (#36860433)
I wish this was stated more. A lot of people new to go have this air of mystery surrounding what coroutines and goroutines are. They'll do something it'll be fast! Then do something else and feel like they are running hardware from the 90s. Not everyone has the know how to strace their applications and think through why something at that level is happening.
Re:Threads and Goroutines by gpderetta on Tuesday July 25, 2023 @06:57AM (#36860525)
Does Go spawn a thread for every non multiplexable system call?

In principle, on linux, you should be able to multiplex stat anyway via io_uring.