How does 'stuck' (in results of 'top') relate to 'not responding' (in Activity Monitor), 'spin' or 'hang'?

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.


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:

  • TH_STATE_UNINTERRUPTIBLE

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 hang-related question that prompted me to post the question here:

  • MacBook Pro with Mountain Lion freezes frequently (full screen Flash in Chrome, Messages, HTC on USB)