Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

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.

share|improve this answer
    
Thanks – if stuck is synonymous with uninterruptible, then I'm familiar with that state. uninterruptible is commonly seen when I key Control-T (SIGINFO) whilst running fsck_hfs from the command line. More on SIGINFO in Apple's termios(4) OS X Manual Page. –  Graham Perrin Jul 31 '12 at 17:12
    
Related to this answer, a question in Stack Overflow may be of interest: How to identify not responding process programatically. –  Graham Perrin Jul 31 '12 at 17:14
1  
I had a look at the source code of top: uninterruptible is the same as stuck. –  patrix Jul 31 '12 at 17:53
    
Gotcha – highlights from libtop.c in open source for Mac OS X 10.7.4. –  Graham Perrin Jul 31 '12 at 19:10
add comment

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:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.