Hacker News new | ask | show | jobs
by BreakfastB0b 1436 days ago
Minor nitpick but goroutines are absolutely not preemptable, they’re cooperative. The go compiler regularly sticks in yield statements around IO, and certain function calls, but you absolutely can starve the runtime by running a number of goroutines equal to the number of cores doing heavy computation, just like Node.JS’s event loop.
1 comments

This changed in Go 1.14 on most platforms: https://go.dev/doc/go1.14#runtime
TIL