
Ask HN: Concurrency in Go vs. C/C++ - Ch3ck
I know in C++ multithreaded programs share memory as to way to track resource access. However in Go this is done through channels. I&#x27;m trying to explore some subtle differences writing concurrent Go code the C&#x2F;C++ way. My aim to find some bad practices in the process and figure out the best way to fix them. I&#x27;m currrently out of ideas.<p>Thanks,
======
cpg1111
I'll preface this with: I am in no way affiliated with O'Reilly. I would
suggest this book for a deeper look into Go's concurrency
[http://shop.oreilly.com/product/0636920046189.do](http://shop.oreilly.com/product/0636920046189.do)
While Go does have channels to allow concurrent communication, it also allows
the use of mutexes for concurrency similar to c/c++. And on the flip side,
there's things like libmill in C that will give you Go-like concurrency. It is
also worthwhile looking at how Go's memory model works (it's similar to
tcmalloc). Additionally, looking at the implementation of channels maybe
interesting for you. It consists of a buffer that gets memcopy'd with mutexes
for synchronization, granted, that's a very simplified view of it.

------
staunch
Rob Pike did a number of interesting talks on concurrency in Go. If you search
"Go concurrency" on YouTube there are more good talks.

Go Concurrency Patterns
[https://www.youtube.com/watch?v=f6kdp27TYZs](https://www.youtube.com/watch?v=f6kdp27TYZs)

Concurrency Is Not Parallelism
[https://www.youtube.com/watch?v=cN_DpYBzKso](https://www.youtube.com/watch?v=cN_DpYBzKso)

