On Fri, Feb 17, 2017 at 6:58 PM, Jens Alfke <j...@mooseyard.com> wrote:
> [from another email] > > It's why I like Go: it's the first language in 30 years to incorporate > > concurrency in its design, and finally support a theoretically sound > > model. > > Goroutines are still threads, and Go programs can and do share memory > between goroutines, No they are not. They may be scheduled on threads, but they are not threads. And the fact you can have several goroutines communicating on a single thread is indicative of that. The same exact code using goroutines and channels can run on 1 thread, or N threads. No explicit yields, no locking, just communication via channels, which are pipe-like in nature, except they are typed and not just bytes. And you don't need threads to do async-I/O in Go either. When Go makes an IO call, it's implicitly async, and the Go routine will often "yield" (be unscheduled) to given another one the opportunity to run while the first is sitting there waiting for its IO to complete. No callback hell, and completely transparent to the programmer. which has all the same concurrency issues you find in C. You do have enough rope to hang yourself with, but Go unlike C has channels and the select statement, and that is what allows Go concurrent programs to be so much easier to write than C, albeit not trivial to write. > Go has a Memory Model specification** that lays out the undefined results > of unsynchronized access to memory by multiple goroutines, and it’s very > much like what the C spec describes. > Of course it does. That's why one of Go's motto is: Do not communicate by sharing memory; instead, share memory by communicating. [1] but sharing memory and locks is still often faster than the implicit model of channels and CSP, so it does not preclude it. I.e. in that one instance, Go doesn't dumb-down too much the language. But it's definitely not the one that's promoted and reserved to high-performance when warranted, and proven by profiling, and even then, one probably shouldn't go there. That's the second time you've mischaracterized Go IMHO. --DD [1] https://blog.golang.org/share-memory-by-communicating _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users