11
2
I tried to kill all my background jobs submit earlier under KUbuntu by
kill -9 $(jobs -p)
Although this command immediately gave the message like
[1] Killed myjob1
[2] Killed myjob2
I can still see their processes hanging in the output of top and the CPU and memory usages are not changed in the output of uptime and free.
So I guess I must have not killed them properly. Can someone please explain what's happening to me and what shall I do?
I found that in top, if type k and input the PID I can kill the processes one by one. SO is this different from the command kill?
I also found somewhere online http://www.ruhr.de/home/smallo/award.html about not recommending kill -9
Useless Use of Kill -9 form letter
(Quote abomination)
No no no. Don't use kill -9.
It doesn't give the process a chance to cleanly:
1) shut down socket connections
2) clean up temp files
3) inform its children that it is going away
4) reset its terminal characteristics
and so on and so on and so on.
Generally, send 15, and wait a second or two, and if that doesn't work, send 2, and if that doesn't work, send 1. If that doesn't, REMOVE THE BINARY because the program is badly behaved!
Don't use kill -9. Don't bring out the combine harvester just to tidy up the flower pot.
Is this true? What does it mean by "send 15", "send 2" and "send 1"? Are they commands themselves or "kill -15 PID", "kill -2 PID" and "kill -1 PID"?
Thanks and regards!
Removing the binary (executable file) will not in itself kill the process. The file system will know the process is using that file and let the process "see" the file even after you removed it. – Jeppe Stig Nielsen – 2016-11-07T10:25:02.783