3 ms·
Came for free? Go takes advantage of multiple cores by using threads. CSP doesn't magically multiplex your code onto your cores.
by abraininavat 14y ago
Came for free? Go takes advantage of multiple cores by using threads. CSP doesn't magically multiplex your code onto your cores.
- jussij 14y ago> CSP doesn't magically multiplex your code onto your cores Take a look at this Rob Pike video: http://blog.golang.org/2013/01/concurrency-is-not-parallelism.html http://blog.golang.org/2013/01/concurrency-is-not-parallelis... Now that video might well be crap, I'll be the first to admit I'm not skill enough to know one way or the other. But based on that video, it does appear to me that Go does offer some form of multi-core magic and it does appear to come at a minimal cost.
- abraininavat 14y agoIt's not magic. It's threads. Go multiplexes your goroutines onto N OS threads. There are also abstractions in C/C++ (though of course as libs, not part of the language, like in Go) which hide the usage of threads. But there is no magic. If your code is running in parallel, your code is using OS threads.