Linux Labs

Users, permissions, and processes / Stage 10 of 13

Observing processes

Not running Starting usually ~20 s
Leave the lesson

Step 4 of 7 · on a machine · 6 min

Process state

In top, every process had a letter in the S column. It tells you whether the process is working right now, waiting, or standing still.

Exercise · look

Three letters under STAT

Run the command: the STAT column is the process state, and %CPU is its share of the CPU. Compare the three indexer rows.

First, predict

--docs and --blog barely use the CPU. What letters will they have under STAT?

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

The first letter in the STAT column is the process state:

Letter State
R running or waiting its turn for the CPU
S sleeping: waiting for a timer, data, or a request
T stopped, standing still until someone continues it

S is the usual state: nearly all of the hundred processes in top were asleep. The --docs process sleeps while there is no work for it and will wake up by itself. The --blog process is stopped: a signal stopped it, and it will not continue on its own. How processes are stopped and continued is covered in the lesson on signals.

Check yourself 1 question

The web server process shows S under STAT and 0.0 under %CPU, and the site has no requests right now. What does that mean?

  • S marks a live process that is waiting for an event and will wake up. A process that has exited cannot sleep.

  • A stopped process is marked T, like --blog in the exercise. S is sleep while waiting for work.

  • S is sleep while waiting for work: the process wakes up on its own when a request arrives, like --docs in the exercise. Nearly all of the hundred processes in top sleep this way.

S means sleep: the process waits for a request, a timer, or data and wakes up when they arrive. Nearly every process on a machine spends most of its time asleep.

Ubuntu 24.04
Loading…