4 ms·
Go does not provide direct access to threads, but multiple goroutines can run on multiple threads simultaneously. Go is not single-threaded like Node.js nor "on
by insertnickname 10y ago
Go does not provide direct access to threads, but multiple goroutines can run on multiple threads simultaneously. Go is not single-threaded like Node.js nor "only one thread can run at any one point in time" like CPython. Go's concurrency provides real parallelism.
- est 10y ago> but multiple goroutines can run on multiple threads simultaneously Is goroutines very effective with CPU-bound computation tasks?
- insertnickname 10y agoI don't know if it's "very effective" (compared to what?), but it's fine to do CPU-bound computation in goroutines. The Go runtime will try to schedule goroutines to run in parallel on different threads.
- why-el 10y agoGo provides real parallelism if run on multiple CPUs, otherwise things are running concurrently (a la Python).
- insertnickname 10y agoOf course. It's impossible to do parallel computation on a single CPU.