Erlang's process not killed by exit signal reasoned by "kill"
Yan Yan
yan.beijing.china@REDACTED
Sat Oct 24 13:07:19 CEST 2009
I am extremely interested in Erlang. However, there is a quite confusing question in Joe's textbook "Programming Erlang, Software for a Concurrent World". I cannot figure it out so I am now sending you an email to talk about it.
(1)On Page 163,
Quote
If the reason is given as kill, then an untrappable exit signal will be sent.
An untrappable exit signal will always kill the process it is sent to, even
if it is a system process.
End quote
(2)On Page 169,
Quote:
8> edemo1:start(true, {die,kill}).
Process b received {'EXIT',<0.73.0>,kill}
process b (<0.72.0>) is alive
process c (<0.73.0>) is dead
ok
End quote.
Here a and b are both system processes, while c is not. When c exits with the reason "kill" (not "killed"), it sends exit signal to b with the reason "kill". Therefore b should be killed and dead, but b is still alive here!
(I had thought it was only a small typo in the book. But then I tested by myself and got the same result: b received the exit signal with the reason "kill" and b was not killed but alive.)
Why is the system process b not killed by the exit signal with the reason "kill"?
P.S. interesting is that if the code exit(kill) in process c is changed to exit(B, kill), b is killed by that signal, which is not conflict with quote on Page 163. I have also tested that both exit(kill) and exit(B, kill) send the same exit signal ({'EXIT', c's Pid, kill}) to B.
Thanks a lot. It will be my honor if anyone can give me a reply and I am looking forward to it.
Sincerely,
Yan Yan
More information about the erlang-questions
mailing list