Reprinted from: https://www.cnblogs.com/liuhouhou/p/5400540.html
Everyone must be very familiar with kill -9, and it is often used in work. Especially when you go to restart tomcat. But for the most part, our understanding of -9 is only superficial.
Few people (including me) take a serious look at what kill -n is. Criticize yourself.
All right. Let's get to know this familiar stranger well.
1)kill
It can be clearly seen from the help that -n refers to the signal number. The question is, who is the "signal number"? ? ?
2) kill -l (view Linux/Unix signal variables)
So many! ! Let 's talk about SIGKILL and SIGTERM separately today
3)(kill pid) 、( kill -15 pid)
The system will send a SIGTERM signal to the corresponding program. When the program receives the signal, the following things will happen
- program stops immediately
- Stop when the program releases the corresponding resources
- Program may still continue to run
After most programs receive the SIGTERM signal, they will first release their own resources and then stop. But there are also programs that can do other things after receiving the semaphore, and these things can be
configured. If the program is waiting for IO, it may not respond immediately.
That is to say, SIGTERM is mostly blocked and ignored.
4)kill -9 pid
Can't you not respond to SIGTERM? ? Well, I'll give you the next kill order, I think you're still not obedient. Most admins will use this command
However, not all programs will be obedient, and there are always programs in those states that cannot respond immediately.