[Chapter 38] 38.14 Processes Out of Control? Just STOP Them
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:49:56Z

#

| Chapter 38 Starting, Stopping, and Killing Processes |

## 38.14 Processes Out of Control? Just STOP Them

Especially if you're a programmer, you can run into a situation where you have processes forking (38.2) out of control - more and more of them. By the time you kill one, fifty more fork.

- On systems with job control (12.1), there's a good answer: use the STOP signal to stop the processes:

      kill
      kill -STOP ...

  Stop any process you can. Then it won't be able to fork more processes. Stop them all. Then start cleaning up with kill -9.

- If your system manager has set a per-user process limit on your computer, the good news is that your processes won't eventually crash the system. But the bad news is, when you try to run any command that isn't built into the shell (1.10):

  >     % ps
  >     No more processes.

  you can't because you're already at your limit.

  If that happens, log on to another account or ask someone to run a command that will give a list of your processes. Depending on your system, the command is probably like one of these two:

  >     % ps -u yourname   System V
  >     % ps aux | grep yourname   BSD

  Then go back to your terminal and start stopping `:-)`. If you get the `No more processes` error, your shell must not have a built-in kill command. The C shell does. Carefully type the next command to replace your shell with a C shell. Don't make a mistake (if you do, you may not be able to log in again):

      exec
      $ exec /bin/csh
      % kill ...

- JP

38.13 Interactively Kill Processes Matching a Pattern |  | 38.15 Cleaning Up an Unkillable Process