If I write a script on Linux, say
#! /bin/ksh
sleep 300
and do a kill on it, I do not get the behavior I would expect.
tcsh 26> sleep.ksh &
[1] 20185
tcsh 27> pss sleep
PID USER COMMAND
20185 wmor /bin/ksh sleep.ksh
20186 wmor sleep 300
tcsh 28> kill -15 20185
tcsh 29> pss sleep
PID USER COMMAND
20185 wmor /bin/ksh sleep.ksh not killed
20186 wmor sleep 300
tcsh 30> kill -2 20185
tcsh 31> pss sleep
PID USER COMMAND
20185 wmor /bin/ksh sleep.ksh not killed
20186 wmor sleep 300
tcsh 32> kill -9 20185
tcsh 33>
[1] Killed sleep.ksh
tcsh 33> pss sleep
PID USER COMMAND
20186 wmor sleep 300 script killed but sleep continues
tcsh 34> kill -9 20186
tcsh 35>
I was taught, but I never trust professors, that for a program to receive a signal it must become runnable and then actually run to process the signal. According to my understanding, a sleep should keep my process from running, which seems in accordance with the kill -15 and kill -2 above, but I can kill -9 the script and that does not apparently kill its child, the sleep, and I can kill the sleep, which I would thik would not be runnable given that it is sleeping.
I have been of the understanding that trap, et. al., can mask other signals, but not -9, and that is the big difference. That does not seem to be the way things are working here.
I got to this forum by trying to find the sleep.c code so I could see if it does something strange like sleep for one second, come up for air, and then repeat for the rest of the count. I don't seem to find the source, but I am googling, I don't really know where to look. What I am really interested in, however, is mysterious NFS failures preventing me from killing jobs using NFS.
Will
How does kill -9 workHow does kill -9 work
Page 1 of 1
1 Replies - 1415 Views - Last Post: 23 June 2008 - 11:20 AM
Replies To: How does kill -9 work
#2
Re: How does kill -9 work
Posted 23 June 2008 - 11:20 AM
What exactly are you trying to do?
If I have the script:
And I run it with sh sleep.sh, I can lookup the process id with ps aux | grep sleep.sh. I can then call kill <pid> to terminate it.
Sending the KILL signal (kill -9) is not a good practice unless the program won't otherwise stop. http://speculation.o...ick/kill-9.html
A sleeping process can still be killed/terminated.
I think this thread is pertinent.
If I have the script:
#!/bin/sh sleep 9999999999999999999
And I run it with sh sleep.sh, I can lookup the process id with ps aux | grep sleep.sh. I can then call kill <pid> to terminate it.
Sending the KILL signal (kill -9) is not a good practice unless the program won't otherwise stop. http://speculation.o...ick/kill-9.html
A sleeping process can still be killed/terminated.
I think this thread is pertinent.
Page 1 of 1

New Topic/Question
This topic is locked



MultiQuote


|