News for hackers. Stuff that matters.
Re:Goroutines are not significantly lighter than threads by Thaxll on Sunday March 14, 2021 @09:26AM (#26455199)
"native threads switching overhead is extremely low, probably lower than usermode Go thread overhead"

This is most likely very wrong.

Re:Goroutines are not significantly lighter than threads by jaen on Sunday March 14, 2021 @06:41PM (#26460195)
When you think about in depth, the kernel can context switch between threads essentially for free when returning from a syscall (the work to restore a userland context is the same regardless of which context it is switching to, disregarding cache effects).

In most apps, context switches would happen only due to kernel->user transitions anyway (such as an I/O syscall finishing or a timer triggering), so in most apps kernel context switches are indeed almost free.

To be significantly more efficient than the kernel there should be much more context switches than syscalls, which for non-synthetic programs is mostly only possible under heavy loads that can batch, with suitable I/O interfaces such as io_uring.

Re:Goroutines are not significantly lighter than threads by otabdeveloper4 on Sunday March 14, 2021 @01:56PM (#26457230)
It isn't. Kernel context switching is the same thing as language runtime context switching, except you get access to kernel mode and you don't have to keep track of garbage collection stuff.