The concurrency and threading in Go just feels like magic compared to every other language. I'm a goroutine addict and I refuse to be rehabilitated.
Just from observations over the years, I don't think there's any other language quite like this, in terms of how things can end up happening in any thread.
C# and Rust (via Tokio) both have M:N threading. They both use a work-stealing algorithm to map many tasks onto a finite thread pool. But you're correct that they are cooperative via async/await, not pre-emptive.
I believe it’s more about robustness than performance in typical cases. Without pre-emption, there’s always a risk of one goroutine using disproportionate CPU time if it gets into an infinite (or just very long) loop without doing any IO.
SamInTheShell · · focus · HN ↗
Just from observations over the years, I don't think there's any other language quite like this, in terms of how things can end up happening in any thread.
osigurdson · · focus · HN ↗
Doesn't that describe pretty much any green thread style concurrency implementation.
dlisboa · · focus · HN ↗
Other languages and their implementations of green threads usually have cooperative scheduling or M:1 mapping
seabrookmx · · focus · HN ↗
serbuvlad · · focus · HN ↗
foldr · · focus · HN ↗