When analyzing process states in Linux using ps
command, you'll occasionally encounter processes marked with D, Ds or D+. While they all represent uninterruptible sleep states, the additional characters provide important context about the process's behavior and status flags.
The base D
state indicates a process in uninterruptible disk sleep, typically waiting for I/O operations to complete. This is the most severe sleep state where the process cannot be killed (even with SIGKILL) until the I/O completes.
ps -eo pid,stat,cmd | grep " D "
1234 D /usr/sbin/some_daemon
The additional characters after D reveal important process attributes:
- D+: Process is in uninterruptible sleep AND is in the foreground process group
- Ds: Process is in uninterruptible sleep AND is a session leader
Here's how to identify these states with additional context using a more detailed ps
command:
ps -eo pid,stat,uid,cmd,wchan:32 | grep -E " D[+s]?"
12987 D+ 1000 du o2net_send_message_vec
14532 Ds 0 [kworker/1:2] nvme_wait_cmd
Understanding the differences helps in:
- Troubleshooting hung processes (D+ processes might indicate foreground processes stuck in I/O)
- Identifying critical system processes (Ds often marks important daemons)
- Debugging complex system issues where process groups matter
Combine with other tools for deeper analysis:
strace -p [PID_OF_D_STATE_PROCESS]
# And for kernel-level tracing:
perf trace -p [PID]
Remember that processes in D state for prolonged periods may indicate hardware or filesystem issues that need investigation.
When examining process states in Linux using ps
, you'll occasionally encounter processes marked with D, D+, or Ds. These represent different variations of the "uninterruptible sleep" state, which occurs when a process is waiting for an I/O operation to complete.
The single-letter status codes can be augmented with additional characters that provide more context:
D - Uninterruptible sleep (usually waiting for I/O)
D+ - Process is in uninterruptible sleep and is in the foreground process group
Ds - Process is in uninterruptible sleep and is a session leader
Here's how you might see these states in practice:
$ ps -e -o pid,stat,comm,wchan=WIDE-WCHAN-COLUMN | grep D
PID STAT COMMAND WIDE-WCHAN-COLUMN
12987 D+ du o2net_send_message_vec
14532 Ds dd wait_for_buffer
17894 D kworker/u4:3 nvme_wait_freeze_timeout
Processes stuck in D state can indicate potential issues:
- Storage device failures or timeouts
- Network filesystem hangs
- Driver bugs or hardware issues
For deeper investigation, try these commands:
# Show processes with wait channel information
ps -e -o pid,stat,comm,wchan:32
# Check for D state processes with open files
lsof -p $(ps -e -o pid,stat | awk '$2 ~ /^D/ {print $1}')
# View kernel stack traces for processes in D state
sudo cat /proc/$(ps -e -o pid,stat | awk '$2 ~ /^D/ {print $1}')/stack
The additional markers (+ and s) indicate:
- D+: The process is in the foreground process group of its controlling terminal
- Ds: The process is a session leader (typically the first process in a new session)
When encountering these states:
# Check for disk I/O wait
vmstat 1 5
# Examine disk stats
iostat -x 1 5
# Check system logs for related errors
dmesg | tail -50