go, parallelism, networking and atomic operations

172 views
Skip to first unread message

Doogie

unread,
Oct 30, 2010, 9:51:49 PM10/30/10
to golang-nuts
Hi
I'm new to the Go programming language (coming from C++, C#)
I have to say I really like the simplicity of the language. It kind of
forces me to think about the program I came to write rather than
trying to understand which feature/pattern to use and what pitfalls
that comes with them.
Anyway, I was wondering if anyone know some good books/tutorials/
examples on how to work with channels when utilizing multiple CPU
cores and how to use them to communicate between network nodes.
I figured they could be used to transfer data over a network but I
haven't quite figured out how, and if they would replace the old
socket interface completely

Also, does Go provide anything in regard to atomic execution?

Any tips or links would be appreciated

Thanks

Andrew Gerrand

unread,
Oct 30, 2010, 10:09:56 PM10/30/10
to Doogie, golang-nuts

All channel operations are thread-safe and atomic.

The "Share Memory by Communicating" code walk gives an overview of an
idiomatic concurrent Go program:
http://golang.org/doc/codewalk/sharemem/

There's the sync package, which provides a Mutex primitive:
http://golang.org/pkg/sync/

There's this reference document, The Go Memory Model:
http://golang.org/doc/go_mem.html

The netchan package allows you to use channels to communicate over
network sockets:
http://golang.org/pkg/netchan/

The rpc package provides a different method of abstracting network
communication:
http://golang.org/pkg/rpc/

I hope that's enough to get you started. Feel free to ask further
questions here on in the irc channel, #go-nuts on irc.freenode.net.
:-)

Andrew

Reply all
Reply to author
Forward
0 new messages