[erlang-in-lisp-devel] watching processes

Faré fahree at gmail.com
Fri Aug 15 04:30:14 UTC 2008


Some ideas to add to a TODO file for e-i-l.

Watching other processes is hard to do reliably in Unix.

If the processes are linked by parent/child relationships, then the
parent can easily watch if children die with SIGCHLD (and *must* do it
to avoid zombies) - but this is not general enough mechanism for
e-i-l.

Another option is to share a pipe with the other process before you
even fork, and add the watching of it in your epoll loop, so you can
say the process is dead when you get an EPOLLHUP. This depends on all
the considered processes following the proper convention of sending
around the fd to the pipe, and so is not applicable to watching
arbitrary other processes, but may work.

It might be possible to open an fd on some file in /proc/$pid and
receive an event when the process dies. Or not.

These solutions require experimentation, but have the advantage that
they are not subject to the same race conditions as having to register
with a central server after you've forked.

[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
It is a miracle that curiosity survives formal education.
        -- Albert Einstein



More information about the Erlang-in-lisp-devel mailing list