Linux Labs

Users, permissions, and processes / Stage 12 of 13

Signals and process termination

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 9 · on a machine · 3 min

Pause: STOP and CONT

Instead of ending a process, you can stop it and continue it later, with the same kill.

STOP stops the process: it freezes in state T, as after Ctrl+Z. CONT continues it from the same spot. Like KILL, STOP cannot be caught by the program.

bash
sleep 800 &
kill -STOP $!
jobs
kill -CONT $!
jobs

jobs shows the job as Stopped first and Running again after. A stopped process is alive: it keeps its PID, memory, and open files. If it was in the middle of writing a file, the file stays unfinished until the process is continued.

Check yourself 1 question

An export is writing its report. You sent it STOP. What happens to the report?

  • A program cannot catch STOP: the process freezes where it was. ps shows it as T, and the report does not change.

  • A stopped process does nothing until CONT arrives. jobs shows it as Stopped.

  • STOP does not end the process, let alone delete files: the stopped process shows T in ps, and the report stays where it is.

STOP pauses the process: its memory, open files, and PID stay, but the work stands still. The report gets finished once CONT continues the process.

Key points

  • STOP pauses a process (T), and CONT continues it from the same spot.
  • A pause is not an exit: the process keeps its memory, files, and PID.
Ubuntu 24.04
Loading…