Finding the process that is actually stuck
medium 6 minA process listing samples a moment.
Video lesson · Chapter 1 of 4
A long queue with almost no CPU
Theory
Read or listen first. About 1 min.
What it is
A process listing samples a moment. R combines running and runnable work. S normally indicates an interruptible sleep, D an uninterruptible wait and Z an exited child waiting to be reaped. CPU percentage needs an interval and a denominator. A process using little CPU may be exactly the worker on the critical path.
Why it exists
A job queue grows while the host looks idle. Start with the parent tree, identify workers for that queue and sample their states repeatedly. Many D-state tasks suggest examining the wait channel and backing resource. A single D state does not identify a particular device. Match blocked workers to device or remote filesystem latency before changing capacity.
If most tasks are runnable rather than asleep, per-core scheduling and group quotas become stronger hypotheses.
A long queue with almost no CPU
Inside this chapter
- Process Investigation with ps, top, htop
- Ps gives a snapshot, while top-style tools sample over intervals. Examine state, thread count, CPU and start time together so a reused process name does not mix two executions.
- Process Tree with pstree
- A process tree links supervisors, workers and helpers. Following parentage can reveal that a busy child belongs to a batch job rather than the user-facing service.
- Process Signals with kill and nice
- Signals request changes in process behavior. Nice adjusts scheduling weight. A change of priority cannot wake a task blocked on storage.
- Process State Diagram (R/S/D/Z/T)
- R means running or eligible, S and D denote different waits, Z identifies an exited unreaped child, and T records a stopped task. Repeated transitions explain more than a single sample.
How it works
Step through the idea, or press Play.
Identify the parent. Follow the process tree from the service supervisor to workers serving the affected queue.
Understand it
Worked incident
A long queue with almost no CPU
| Observation | Tasks in uninterruptible sleep (tasks) | Interpretation |
|---|---|---|
| Baseline | 0 | Workers take jobs and return promptly. |
| Incident | 18 | Several consecutive samples show the workers blocked in the same wait. |
| After intervention | 1 | Restore backing-resource latency and check queued work drains without adding workers. |
Choose the next investigation
Summary
The whole topic in one minute.
A D-state task is waiting uninterruptibly. Resource correlation is needed to identify the subsystem responsible.
If most tasks are runnable rather than asleep, per-core scheduling and group quotas become stronger hypotheses.