Go: Process isolation rediscovered as a programming pattern
popalg.org
popalg.org
Surely, you can debug your programs, but catching slow leaks in complex software is hard, even in Go.
I don't think this warrants restarting your goroutines. Go is still a young language, who knows what tools for debugging will come along in the future.
It is in fact one of the standard strategies in erlang supervision trees: a subtree crashed, log the signal somehow and spawn a new subtree. No point in interrupting the service if you don't absolutely have to.
If you have memory leaks in a subtree, you can just kill it and let things recover in a standard manner, while you're investigating the cause of the leak (or not, you may have more important stuff to do)
> Go is still a young language, who knows what tools for debugging will come along in the future.
While that's true, Go has not exactly been at the forefront of language innovation so far and I've yet to see truly good tools for memleak investigation and debugging in more innovative languages...
That's a huge part of the Erlang philosophy.
So the concepts described in TFA do indeed already exist in Erlang.
Well of course, since it needs to be implemented in the first place whereas Erlang provides it as part of its core features.
seems to be identical to what already exists in Erlang. it is pretty easy, imho, to have an appropriately defined 'terminate' in a 'receive' clause, of an erlang process. on receipt of the said message, erlang process can exit out of the event-processing loop, thereby terminating the process.
not sure why author thinks this is not present in Erlang.
this is part of the core language, and has nothing to do with OTP, which is a framework built on top of the language.
edit-1 : clarified OTP's role (or lack of it).
I don't understand why TFA says this does not exist anywhere else (let alone suggest it could be implemented in Erlang when erlang already goes quite far beyond that)
Here's a relevant article for those not familiar with the concept:
http://docs.racket-lang.org/reference/eval-model.html#(part....
Of course, it doesn't map trivially, since there are no existing references to goroutines. But, it may possible to determine if a goroutine cannot communicate with anyone - it is garbage - if there is no one listening to any of its channels. The one exception to this rule I can think of are daemon-style goroutines that would interact with the system through external calls. Such goroutines could be labeled as such at the creation site, indicating that the goroutine manager should not manage them.
OS-level processes are very expensive (and the OS themselves may set quite harsh limits on e.g. the number of processes you can have[0]) leading to lower flexibility.
Furthermore, process-based IPC tends to be untyped (unless you're willing to pay for the price of serialization and deserialization of higher-level structures).
Finally, the ability to link processes together and react to events (mostly death) of unrelated processes (no SIGCHLD and no SIGHUP) are limited.
[0] it defaults to 532 on a non-server Snow Leopard system, for instance...
They're not 300-bytes cheap. They're not you-can-have-a-million-of-them-on-a-desktop-box cheap.
Erlang's processes are.
After all, there's nothing to stop you from implementing this in Python right now with thread-local storage, and I'm sure you could achieve the same effect with other languages if you don't like the idea of the GIL or slow interpreted languages.
Very often you create a goroutine to send messages down channels. Those messages are objects. Those objects may go to multiple other goroutines.
Kill the originating goroutine and you've just messed up all of the other goroutines that thought that they had objects.
I can see how this might be used for certain specific things. Because of this specificity, a library would be more appropriate than adding it to the language, though.