How to implement inter-process communication in Go?

Go has a built-in RPC system (http://golang.org/pkg/rpc/) for easy communication between Go processes.

Another option is to send gob-encoded data (http://blog.golang.org/2011/03/gobs-of-data.html) via network connection.

You shouldn’t dismiss local networking without benchmarking. For example Chrome uses named pipes for IPC and they transfer a lot of data (e.g. rendered bitmaps) between processes:

Our main inter-process communication primitive is the named pipe. On
Linux & OS X, we use a socketpair()

— http://www.chromium.org/developers/design-documents/inter-process-communication

If named pipes are good enough for that, they are probably good enough for your use case. Plus, if you write things well, you could start using named pipes (because it’s easy) and then switch to shared memory if you find performance of named pipes not good enough (shared memory is not easy regardless of the language).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)