1

When I ps aux | grep 'S' I see a few programs that I want to kill. According to man ps the state code for S is interruptible sleep (waiting for an event to complete). I've tried kill [Process ID (PID)] and also sudo kill [Process ID (PID)]. Despite my efforts they're all still in interruptible sleep. NB: I don't want to kill all (killall) the PIDs.

Q: Is there anyway of killing these PIDs? Or an alternative way of stopping them?

3kstc
  • 4,706
  • 1
    Are you using kill -9 (i.e., kill -KILL)? Might these processes be catching or ignoring SIGTERM? – Scott - Слава Україні Mar 10 '15 at 23:30
  • @scott would this be kill -9 [PID]? And what does kill -9 do, because I don't want inadvertently kill other PIDs in the server. – 3kstc Mar 10 '15 at 23:39
  • Oh my goodness; you're doing kill with sudo privileges, and you haven't read the kill man page! Oh my! – Scott - Слава Україні Mar 10 '15 at 23:44
  • @scott I honestly have read the man kill but I've concluded that kill -9 [PID No] is going nuclear. So I just want to reconfirm. I've messed up by running the same program multiple times in the background, which is why I want to kill them now. – 3kstc Mar 10 '15 at 23:54
  • 1
    It's more like using kryptonite or a silver bullet; it's a way of killing a process that doesn't want to be killed (e.g., it catches every signal it can, including SIGTERM). It shouldn't be dangerous if you're careful not to give it parameters you don't mean to; e.g., *don't* do kill -9 0. (Don't aim a gun at something unless you want to kill it.) If you're trying to kill your own processes, there's no reason to use sudo: it doesn't make the command more effective, but it does make it more dangerous. – Scott - Слава Україні Mar 11 '15 at 00:11
  • @scott, I've read up on kill -9, and now I understand! Many thanks! – 3kstc Mar 11 '15 at 01:14

1 Answers1

0

kill -9 [PID value] kills that particular PID. To better understand we can consider kill -9 to act like a power shortage, just on that single process/PID. The PID will be terminated unconditionally - without the chance of cleaning up/flush the caches by the operating system. This in turn may result to zombie processes appearing, but they will disappear upon reboot. As for the resources, the operating system will reclaim these resources after the PID has been kill -9'ed.

3kstc
  • 4,706