5

It is said that if configured erlang with cookie setting, the erlang's process could be run across different machines, and this is transparent to the caller. Is that possible for goroutine run like this?

python
  • 1,870
  • 4
  • 24
  • 35

1 Answers1

7

This is not a feature of the language, no. However, since there's no way in the language to ask about goroutines (for example, to get a thread ID or control them from a different goroutine like in some other languages), as long as you could set up transparent communication mechanisms (for example, channels that work over the network), you could create a similar effect. In fact, Rob Pike, one of the creators of Go, has toyed around in the past with a package he called "netchan" to do exactly this, but couldn't get the semantics right, and so he hasn't published a finalized version yet. It's definitely something he's still interested in, though, and would certainly be consistent with the Go approach to abstraction.

Community
  • 1
  • 1
joshlf
  • 21,822
  • 11
  • 69
  • 96
  • thanks for your answer! Is there a best practice if I want to implement similar communication like erlang's process run across different machines? – python Sep 03 '14 at 12:53
  • Your answer is really helpful, as I have read some document of golang, no similar features found. I was thinking as Go kind of follow the CSP rule like erlang, there might be a feature like erlang. However it turns out no, hope one day it will implement this. – python Sep 03 '14 at 12:57
  • Glad I could help! It's certainly within the design of the language to allow it eventually; I'd love to see it too. – joshlf Sep 03 '14 at 13:00
  • 5
    The tumblr people released something that you might find relevant: https://github.com/tumblr/gocircuit – Dmitri Goldring Sep 03 '14 at 13:16
  • There was a talk about Gocircuit in the last GopherCon: https://www.youtube.com/watch?v=i2VaXnRhob0 and it looks promising! – siritinga Sep 04 '14 at 07:21