Stop staring at “Running” when your process is actually stalled
Process & Resource Monitoring (Top/Htop/Ps/Systemd)
Stop staring at “Running” when your process is actually stalled
🧩 The Challenge
You’ve got a critical script running, maybe a database export or a filesystem sync. You check on it after a while, `top` shows it’s still there, ‘S’ or ‘R’ state, but it’s clearly not making progress. Your stomach sinks. Is it hung, waiting on some obscure I/O lock, or just really, really slow? You’re blind without a debugger.
💡 The Fix
Instead of just seeing “running,” `ps` can actually tell you the specific kernel function your process is currently blocked on. It’s a lifesaver for quickly diagnosing why that ‘running’ process isn’t actually doing anything useful.
# First, find your process ID (PID). Let's say it's "my_stuck_backup.sh"
pgrep -f "my_stuck_backup.sh"
# Then, use that PID with ps to see its wait channel
# Replace 12345 with the PID you got from pgrep
ps -eo pid,comm,stat,wchan:20 -p 12345
⚙️ Why It Works
The `wchan` (wait channel) column shows the name of the kernel function where the process is sleeping or waiting. If it’s something like `wait_for_completion`, `pipe_wait`, or `io_schedule`, you know it’s stuck waiting for an event or I/O. If it’s `-`, the process is actually running or runnable.
🚀 Pro-Tip: Combine this with `watch -n 1` to continuously monitor a flapping or intermittently stuck process.
Linux Tips & Tricks | © ngelinux.com | 10/16/2026
