Sometimes a few process are in a stuck state. For example:
PID COMMAND %CPU TIME #TH #WQ #POR #MREGS RPRVT RSHRD RSIZE VPRVT VSIZE PGRP PPID STATE
99357 plugin-container 0.1 12:07.07 10 1 224 2097 40M 84M 66M 82M 2757M 91688 99346 sleeping
99346 firefox 0.4 48:54.20 29 1 265 16250 467M 172M 799M 538M 4210M 91688 1 sleeping
88029- Aquamacs 1.2 31:24.12 4 3 126 268 19M 49M 32M 36M 777M 88029 152 stuck
Is it part of the normal life cycle of process ? Why this process in particular ?
What does it mean exactly ?
Best Answer
It is not necessarily a bad sign, but let me answer your last question first:
What does it mean exactly?
In the
top
source code (from http://www.opensource.apple.com/release/mac-os-x-1082/) the stuck state is referred to as identifierLIBTOP_STATE_STUCK
(fromlibtop.c
):Later in the same file,
LIBTOP_STATE_STUCK
is mapped to kernel stateTH_STATE_UNINTERRUPTIBLE
:So a process in stuck state means that the process/thread is in an uninterruptible wait state, which is how
TH_STATE_UNINTERRUPTIBLE
is defined in the kernel structthread_basic_info
(see http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_basic_info.html):where
run_state
is:This is usually caused by a process waiting on I/O, that is, the process has requested to read or write to/from disk or the network and waits for the system call to return (see http://en.wikipedia.org/wiki/Sleep_%28operating_system%29#Uninterruptible_sleep or http://www.novell.com/support/kb/doc.php?id=7002725 for more information).
(When not using BSD options, as it is usually the case in Linux,
ps
shows uninterruptible sleep as D state.)Is it part of the normal life cycle of process?
Yes, it is. What is not normal is that a process stays in this state for a long time. That's a bad sign.
Why this process in particular?
Difficult to say. It is usually caused by I/O bottlenecks with heavy disk activity or degraded connectivity when using network filesystems (the most usual scenario, in my experience).
(This is a related question in Ask Different: https://apple.stackexchange.com/questions/58697/how-does-stuck-in-results-of-top-relate-to-not-responding-in-activity-m.)