kill command doesn't do anything - Is Mac OS X *REALLY* Unix

A few times now I have had trouble getting various apps to quit. I try using Force Quit, but that almost never works.
Aside on Force Quit: With apps that are not responding, I choose Force Quit from the Apple menu, then as I select apps and click the Force Quit button, they obediently disappear from the list, but nothing seems to actually be happening - the app is still there, and when I close and reopen the Force Quit dialog, they're back in the list! Force Quit from the context menu of their dock icons also does nothing...


Anyway, so having tried Force Quit and not gotten anywhere, I open up a Terminal window (thinking, here we go, OS X is Unix so I can get right down to the low-level stuff here). I use ps to find out the PID of the app's process and use kill -9 <PID> to try to terminate it manually.

...but NOTHING! If I run the ps command again, the process is STILL THERE!

So now I'm thinking, hang on a second! This is supposed to be Unix, uber-low-level control! I've never had the kill command not work on any other Unix system...

Maybe I'm a paranoid conspiracy theorist or something, but this experience has made me wonder if OS X really is Unix and not some kind of Unix emulation wrapped around a proprietary kernel.

Someone please put my fears to rest (and oh yeah by the way also help me with the kill command thing).

Posted on Oct 16, 2005 9:49 PM

Reply
38 replies

Oct 19, 2005 9:33 PM in response to danuke

Hi Trav,
I think the thread is pretty much played out. I don't think a little diversion could hurt. The comedic quotes at the end of my posts are generated by the program "fortune", which fink will install. Actually, I think the "fortunes" and "fortune-mod" packages are both required to get all of the quotes but it's been a while.

I have an AppleScript named fsi.app saved as an application that brings the Terminal to the front, (choosing a window that isn't busy) invokes a shell script named "fsi" with the argument "Omniweb", my browser. That shell script produces a new fortune and waits until I hit a key. If I hit the 'n' key, the script exits. If I hit any other key, it produces a new fortune and waits again. (it really just invokes itself) If I hit the 'y' key, it puts the fortune into an HTML signature, puts that into the clipboard, brings my browser to the front and invokes "paste" from the menu. If the cursor was in the text window at the end of my post, the signature is pasted at the end and I just click "Post Reply".

I've put the scripts into a tarball that you can download from fortune_sig. For the "system" to work, "fortune" and the "fsi" shell script must be in your path. For GUI AppleScripting to work, you must have "Enable access for assistive devices" checked in the "Universal Access" pane of "System Preferences". How you invoke the AppleScript is up to you but I have it set to respond to a hot key so that I can do the whole thing without using the mouse.
--
Gary
~~~~
Pittsburgh driver's test

(2) A traffic light at an intersection changes from yellow
to red, you should

(a) stop immediately.
(b) proceed slowly through the intersection.
(c) blow the horn.
(d) floor it.

The correct answer is (d). If you said (c), you were almost
right, so give yourself a half point.

Oct 20, 2005 12:19 AM in response to danuke

Actually, zombie processes are something entirely different.

When a process creates a child process - say when you have a program that starts another program - when that started program completes, in enters what is called the "zombie" state. The process is dead, but status about it has not yet been collected (a processs called "reaping") by either its parent process or the system.

When a process is zombied, it's dead yet still exists. Because it will never run again, it too is immune to any signals that may be sent its way.

In short, though zombied processes are immune to signals, that's not what's happening with processes that are still running but that are not responding to signals; they fall into the other category I had mentioned earlier, they are likely stopped in an uninterruptable wait.

Processes in these two states can be seen as being in the Z or U states, respectively, as reported by the shell command ps aux.

So, how do you kill a process stuck in an uninterruptible wait? Well, you can't, that's why it's uninterruptible. Sometimes you can get such a process to die by killing its parent, as upon receiving the signal the parent may be able to tear down the process that's waiting, but other times the only answer is to either wait for the process or to reboot the machine.

As an aside, most times a process is hung and cannot be killed, it is waiting, but it is waiting in time periods that humans are uncomfortable with. For example, in recent threads about Safari becoming "hung" under certain circumstances, it's not really hung, but given it will often take 30 minutes or more for the system to recover, as far as most users are concerned it may as well be…

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

kill command doesn't do anything - Is Mac OS X *REALLY* Unix

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.