Go Goroutines Concurrency
The cluster discusses Go's concurrency model, focusing on goroutines as green threads managed by the runtime, their efficiency compared to OS threads, misconceptions about single-threading, and comparisons to Node.js or other languages.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Go is not a single threaded language.
Where's the evidence that Go can't handle large amounts of concurrency?
He wrote that "In Go, writing concurrent code is more natural and efficiency of goroutines is much better than threads." I would have assumed goroutines were threads too. If not, how are they implemented?
I believe you're thinking of concurrency, which go handles pretty well with goroutines.
how does this compare to using Go goroutines?
Isn't go's greenthread offering part of it's runtime? If you use a go channel or thread, is that not calling some go std lib abstraction? What you're talking about seems like a pretty non-idiomatic use of go.
Goroutines are "green threads", small threads managed by the Go runtime and scheduled within multiple OS processes. I've never seen any indication that they're inefficient; I regularly create and destroy thousands of goroutines in less than a second. Oh, and Go doesn't have a global interpreter lock, so I'd expect the threading to work better than in python.
In Go, the coroutines are in the same thread. There is a single thread here too(just like node.js). Coroutines are just multiplexed to the one main thread. Multi-Core Processing is handled by coroutine internals too i.e. there may or may not be more than one threads and even if there are more than one threads, they too will be multiplexed with the one main thread.
How about switching to Go and using goroutines?
Goroutines are not primarily about performance, they are for modelling concurrent processes in a natural way. This can have a performance in some cases, but I wouldn't classify goroutines the way you have.