Announcement
Collapse
No announcement yet.
How To Use ps, kill, and nice to manage processes
Collapse
This topic is closed.
X
X
-
An interesting article. However, I disagree with some of the recommendations regarding the "kill" command. (I've been fighting these bad ideas about how to correctly "kill" processes for a long time.) Namely, "kill -9" or "kill -KILL" should be the last option, not the second when trying to kill a process. I say this because SIGKILL is a signal that cannot be caught by a process and so it has no chance to clean up and die gracefully. This means that the process's data store might be corrupted or left in an unrecoverable state. Also, there's no guarantee that a SIGKILL sent to a process will make it die. Processes caught in a disk-wait state cannot be killed by any signal.
Secondly, the HUP or HangUp signal has been re-purposed by service processes to restart or reread its configuration files. But, the original meaning of SIGHUP was that a modem connection was going down so a process (and a login session) should clean up and exit as soon as possible.
I do use kill -9, but rarely. I use it only after trying "kill nnn", "kill -INT nnn", "kill -HUP nnn", and "kill -ABRT nnn". SIGABRT can be helpful in that it might cause the process to create a core image file so that debugging can happen.
Of course, a misbehaving process might not die gracefully even using these steps. Nevertheless, it's my opinion that a savvy administrator would try the less drastic measures before using the "big gun" of kill -9.
Sorry, this is one of my pet peeves that has surfaced after developing software for Unix/Linux over the last 3 decades.
- Top
- Bottom
-
Originally posted by andystmartin View Post....
I do use kill -9, but rarely. I use it only after trying "kill nnn", "kill -INT nnn", "kill -HUP nnn", and "kill -ABRT nnn". SIGABRT can be helpful in that it might cause the process to create a core image file so that debugging can happen.
Of course, a misbehaving process might not die gracefully even using these steps. Nevertheless, it's my opinion that a savvy administrator would try the less drastic measures before using the "big gun" of kill -9.
Sorry, this is one of my pet peeves that has surfaced after developing software for Unix/Linux over the last 3 decades."A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
– John F. Kennedy, February 26, 1962.
- Top
- Bottom
Comment
Comment