17

In results of top commands, I sometimes see stuck.

Apple's top(1) OS X Manual Page does not explain this use of the word.

How, if it all, does stuck relate to the following?

  1. not responding – may be seen in Activity Monitor, in the Force Quit Applications dialogue of loginwindow, and so on
  2. .hang files – may be present at /Library/Logs/DiagnosticReports
  3. .spin files – may be present at /Library/Logs/DiagnosticReports

There's an an accepted answer for the first point. Answers relating to points 2 and 3 will be appreciated.

15

There is usually no correlation between a stuck process of top and a non-responding application:

  • stuck means that the process is currently un-interruptible which usually is the case if the process is waiting for a disk or network data block to be read (or similar low-level stuff). Technically speaking the process is executing in kernel space (aka Unix kernel) and can not be interrupted (so even a kill -9 wouldn't have any impact). Usually these stuck states only last milliseconds (as you can see in top as well because the number of stuck processes changes with every display cycle).
  • non-responding applications can be too busy to reply to any event OS X throws at them.

I see one situation where a stuck process corresponds to a non-responding application: A process can be stuck for a very long time, perhaps stuck endlessly, without any possibility to kill it. This usually is the result of some programming error, e.g. improper disconnection from a networked device then the kernel keeps trying to read from it. In cases like this even a forced termination will not remove the process.

1

Process state U, TH_STATE_UNINTERRUPTIBLE and Linux process state D

Someone else drew attention to MacOS top: “stuck” means “uninterruptible” | nelsonslog

… TH_STATE_UNINTERRUPTIBLE, which I believe is what ps reports as process state “U”. I’m guessing this is what Linux calls “D” for “Device Wait”. In which case, in most cases the process is fine, it’s waiting for some I/O to complete. …

The Ubuntu man page for ps confirms a process state code –

D    Uninterruptible sleep (usually IO)

– with no other mention of uninterruptible.

In FreeBSD/Linux Linux Kernel Cross-Reference:

I found a 2002 discussion The Answer Gang 83: How to kill a process in uninterruptible sleep state? (highlights) that fits nicely with the observations made by @patrix.

Last but not least, a 2004 post [X-Unix] PS and Stuck Processes (highlights) mentioning WindowServer, which fits nicely with the -related question that prompted me to post the question here:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .