What Does D State Mean in htop?

When monitoring system performance using the htop command-line tool in Linux, you may occasionally see a process marked with a status of D. This article explains what the “D” state signifies, why it occurs, and how it impacts your system. You will learn about uninterruptible sleep, its common causes—such as heavy disk I/O or stuck network drives—and the standard methods used to resolve these stubborn processes.

Understanding the Uninterruptible Sleep State

In Linux process management, the D state stands for uninterruptible sleep (Data deferment / Disk sleep). When a process enters this state, it is actively waiting for a hardware resource or a kernel-level operation to complete, most commonly direct Input/Output (I/O) operations like reading from or writing to a hard drive.

Unlike standard sleeping processes (marked as S for interruptible sleep), a process in the D state cannot be interrupted by asynchronous signals.

Key Distinction: A process in the S state will wake up immediately if you send it a termination signal. A process in the D state will completely ignore all signals, including SIGINT (Ctrl+C) and the uncatchable SIGKILL (kill -9), until the kernel resource it is waiting for becomes available.

Common Causes of the D State

Processes usually transition into the D state for a fraction of a second during normal disk operations. However, if a process remains stuck in the D state for an extended period, it typically points to an underlying hardware or configuration issue.

How to Handle a Stuck “D” Process

Because the kernel protects processes in the D state to prevent data corruption and filesystem instability, you cannot force-terminate them using standard commands like kill. If you have a process lingering in this state, consider the following troubleshooting steps:

1. Identify the Source of the Block

Before acting, determine exactly what the process is waiting on. You can check the system logs or use the wchan (waiting channel) metric to see the kernel function blocking the process:

ps -eo pid,stat,wchan,cmd | grep " D "

2. Clear the Underlying Hardware or Network Block

If the process is stuck on a network share, attempting to forcefully unmount the share can sometimes break the cycle and release the process:

umount -f -l /path/to/network/mount

3. Check System Logs for I/O Errors

Run dmesg or check /var/log/syslog to look for disk read/write errors or hardware timeouts. If your storage controller is resetting or reporting errors, fixing the drive issue is the only way to clear the process.

4. The Last Resort: Rebooting

If the hardware or network connection cannot be restored, the process will remain in the D state indefinitely. Because the kernel will not kill the process, your only remaining option to clear it from memory is to safely reboot the system.