The difference between Linux kill-9 and kill-15

Source: Internet
Author: User
Tags posix

"My goodness! , the page editor does not have the ability to automatically save drafts. I didn't write anything yesterday. Forget it, don't care about this. I didn't write much anyway.

Hee Hee

You must be very familiar with kill-9 and often use it in your work. Especially if you're going to restart Tomcat. But for the most part, our understanding of-9 is only superficial.

Very few people (including me) take a serious look at what kill-n this n is. Criticize yourself.

All right. Let's take a good look at this familiar stranger.

1) Kill

From the help can clearly see that the-n refers to the signal number, The problem came, "signal number" is the big God???

2) kill-l (view Linux/unix's signal variable)

So much!! Say it alone today, SIGKILL and SIGTERM .

3) (kill pid), (kill-15 pid)

The system sends a sigterm signal to the corresponding program. When the program receives the signal, the following things will happen

    1. The program stops immediately.
    2. When the program releases the appropriate resources and then stops
    3. The program may still continue to run

When most programs receive a sigterm signal, they release their resources and then stop. But there are programs that can do something else after receiving the semaphore, and these things can be

Configured. If the program is waiting for IO, it may not be done immediately.

In other words, sigterm are mostly blocked and ignored.

4) Kill -9 PID

Can't you not respond to sigterm?? Well, I will give you a kill order, I see you are not good. Most of the admin will use this command

However, not all programs will be obedient, there are always those in the state of the program can not immediately corresponding.

Appendix:

Linux Signals

Signal Name Number Description
SIGHUP 1 Hangup (POSIX)
SIGINT 2 Terminal Interrupt (ANSI)
Sigquit 3 Terminal Quit (POSIX)
Sigill 4 Illegal instruction (ANSI)
SIGTRAP 5 Trace Trap (POSIX)
Sigiot 6 IOT Trap (4.2 BSD)
Sigbus 7 BUS error (4.2 BSD)
SIGFPE 8 Floating point Exception (ANSI)
SIGKILL 9 Kill (CAN ' t be caught or ignored) (POSIX)
SIGUSR1 10 User defined signal 1 (POSIX)
SIGSEGV 11 Invalid Memory Segment Access (ANSI)
SIGUSR2 12 User defined Signal 2 (POSIX)
Sigpipe 13 Write on a pipe with no reader, broken pipe (POSIX)
Sigalrm 14 Alarm Clock (POSIX)
SIGTERM 15 Termination (ANSI)
Sigstkflt 16 Stack fault
SIGCHLD 17 Child process has stopped or exited, changed (POSIX)
Sigcont 18 Continue executing, if stopped (POSIX)
SIGSTOP 19 Stop executing (CAN ' t be caught or ignored) (POSIX)
Sigtstp 20 Terminal stop Signal (POSIX)
Sigttin 21st Background process trying to read, from TTY (POSIX)
Sigttou 22 Background process trying to write, to TTY (POSIX)
Sigurg 23 Urgent condition on socket (4.2 BSD)
Sigxcpu 24 CPU limit exceeded (4.2 BSD)
Sigxfsz 25 File size limit exceeded (4.2 BSD)
Sigvtalrm 26 Virtual Alarm Clock (4.2 BSD)
Sigprof 27 Profiling Alarm Clock (4.2 BSD)
Sigwinch 28 Window size change (4.3 BSD, Sun)
SIGIO 29 I/O now possible (4.2 BSD)
Sigpwr 30 Power Failure Restart (System V)

Reference Documents :

https://major.io/2010/03/18/sigterm-vs-sigkill/
http://blog.csdn.net/ashlingr/article/details/8057825
Http://www.comptechdoc.org/os/linux/programming/linux_pgsignals.html

The difference between Linux kill-9 and kill-15

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.