Difference between 'Killed' and 'Terminated'
Asked Answered
A

2

23

I was just testing kill switch flags with a sleeping process.

First i tried killed it with -15

 xtechkid@ubuntu:~/Desktop/expermiments$ ps cax | grep 10005
 10005 pts/2    S+     0:00 sh
 xtechkid@ubuntu:~/Desktop/expermiments$ kill -15 10005

And the process got terminated

 xtechkid@ubuntu:~/Desktop/expermiments$ sh testscript.sh
 This is a script which sleeps for few seconds ..
 Terminated

Then i killed it with - 9

 xtechkid@ubuntu:~/Desktop/expermiments$ ps -ef | grep testscript.sh
 xtechkid 10059  9852  0 13:48 pts/2    00:00:00 sh testscript.sh
 xtechkid 10064 10007  0 13:48 pts/4    00:00:00 grep --color=auto testscript.sh
 xtechkid@ubuntu:~/Desktop/expermiments$ kill -9 10059

And the process got killed

 xtechkid@ubuntu:~/Desktop/expermiments$ sh testscript.sh
 This is a script which sleeps for few seconds ..
 Killed

What is the difference ?

Abreast answered 6/10, 2013 at 6:34 Comment(0)
O
46

The 'terminate' signal, SIGTERM, is a signal that can be intercepted in a program. Often processes which are meant to run in the background will catch this signal and start a shutdown process, resulting in a clean exit. The 'kill' signal, SIGKILL, cannot be intercepted. When this is sent to a process it will result in an abrupt termination of that program.

When you shutdown or reboot your computer for example, usually a SIGTERM is sent to the running processes first allowing them to exit in a clean way if they support it. Then, after a few seconds a SIGKILL is sent to the processes which are still running so that resources in use are forcibly released (e.g. files in use) and the shutdown sequence can continue (e.g. unmounting filesystems)

Oracular answered 6/10, 2013 at 7:19 Comment(0)
T
12

Terminate : it will store all your data before shutting down (write data from RAM to disk, logs, etc)

Kill: It is more like pressing PC power and reset button. It wont save any logs or other data.

Tighe answered 6/10, 2013 at 6:44 Comment(2)
I like this metaphor of PC power and reset button.Godfry
in other word, terminate is gracefully exit while kill is notUnspoiled

© 2022 - 2024 — McMap. All rights reserved.