4 ms·
The original PR line taken by Go team was that langauges like Java "communicate by sharing" whereas in Go you would "share by communicating". It wasn't so much
by eternalban 9y ago
The original PR line taken by Go team was that langauges like Java "communicate by sharing" whereas in Go you would "share by communicating". It wasn't so much about Green vs Native threading as it was about the core semantics of Goroutines and Channels. This original PR also had annoying (to people such as myself) aspect of poopooing Java in context of concurrency (of all things).
As it happens [lol] facts asserted themselves and (at least some in) Go community saw the reason as to why "communicating by sharing" paradigm ever got traction. "It's performance, stupid", to paraphrase Slick Willy, not because other language designers were thoughtless. So now it is "idiomatic" to see Go code using both paradigms (locking & passing channels). The original matra was quietly dropped along "systems programming PL" bit somewhere along the line.
This OP type of article, in an interesting way, continues this pattern of "let's do it this [obvious] way" in face of dealing with concurrency. No less an authority than Cliff Click has asserted that lock-free type algorithms pretty much require a GC.
Concurrency and memory management seem to be zero-sum games. Root cause is clearly Physics, and not the mechanism devised to deal with the physical realities.
- dullgiulio 9y agoChannels pass ownership of allocated objects, they don't perform copies or allocations themselves (once you've allocated the channel and the objects you want to pass). I don't think the article says anything about concurrent allocations; in fact, the various signers don't need to share anything (mutable) to sign the requests they get.
- eternalban 9y ago> Channels pass ownership of allocated objects, they don't perform copies or allocations themselves (once you've allocated the channel and the objects you want to pass). And? Did I say they did? > I don't think the article says anything about concurrent allocations No it doesn't. Point was that it is not a general purpose approach. GCs are.
- dullgiulio 9y agoI've just searched for the word "channel" in the article: zero results. The "original mantra" is "Channels orchestrate, locks serialize" and hasn't been dropped by anyone.
- eternalban 9y ago2010: https://blog.golang.org/share-memory-by-communicating https://blog.golang.org/share-memory-by-communicating There is nothing wrong with that approach. It does put a ceiling on performance, however.