News for hackers. Stuff that matters.
Re:Goroutines are not significantly lighter than threads by coder543 on Friday March 12, 2021 @10:57PM (#26443817)
Not exactly. It depends on the syscall. Syscalls that are known to be slow are treated the way you're describing, but syscalls that are often fast are treated optimistically in a way that allows the work queue to be stolen and spawned onto a new thread only if the syscall doesn't return quickly.

I don't know which category epoll fits into, but it seems like it should be treated optimistically, since epoll is used for non-blocking I/O.

https://utcc.utoronto.ca/~cks/space/blog/programming/GoSched...

Re:Goroutines are not significantly lighter than threads by refenestrator on Friday March 12, 2021 @11:18PM (#26443921)
read(2) has to fit into the "might block" bucket, though, right? It would take a very smart runtime to figure out you just called epoll recently and established it won't block.