Linux Labs

Inside the system: resources, kernel, processes / Stage 1 of 12

Load average and CPU load

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 7 · on a machine · 6 min

Processes in the D state

Find the processes that keep the load average high while the CPU is free, and try to end them with a signal.

Exercise · look

End the processes in D

Find the processes in the D state, send the tar processes the KILL signal and look at them again.

First, predict

What will ps -o stat,pid,cmd -C tar show after sudo pkill -9 -x tar?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in

A process enters the D state (uninterruptible sleep) inside the kernel when it waits for an operation on a disk or a filesystem to finish. Stopping that operation halfway is impossible — the data would be left half-written. So the kernel delivers a signal, even SIGKILL, only after the wait. You sent pkill -9, yet the tar processes stayed in D: the signal waits its turn.

Usually D lasts a fraction of a second, and ps hardly ever shows it. A long D means the storage itself is stuck: the disk answers slowly, a network disk is gone or the filesystem is frozen. Here it is the last one. A disk snapshot program froze writes to /srv/backup with fsfreeze -f to get a consistent snapshot, and never unfroze it. Every process that writes there falls into D.

Unfreeze the filesystem and look at the processes again:

bash
sudo fsfreeze -u /srv/backup
ps -eo stat,pid,cmd | grep '^D'

The list is empty: the wait is over, and the tar processes received their SIGKILL. The load average will keep falling for a few more minutes — it is an average.

Ubuntu 24.04
Loading…