6.2. Suspending a Process
You want to suspend a process from running. This is helpful if you want to temporarily stop an application from running, perhaps due to high CPU consumption, but you don't want to kill it. This can give you an opportunity to launch further diagnostic utilities to troubleshoot the process.
Using a graphical user interface
Open the Sysinternals Process Explorer tool (procexp.exe). To suspend a process, right-click on the target process and select Suspend. To resume a process, right-click on the target process and select Resume.
Using a command-line interface
The following command suspends a process:
<PID> with the
process ID of the target process.
The following command resumes a suspended process:
> pssuspend -r
Currently, no scripting API supports suspending processes.
However, you can use the
ResumeThread functions that are defined in
kernel.lib if you are using a
high-level language such as Visual Basic or C++.
Applications are much better behaved these days than they were a few years ago, but that still doesn't mean you won't see one from time to time peg the CPU on a system and render it virtually useless. If this happens on a remote system, it can be difficult to even use Terminal Services to access the machine. So what can you do? Well, if you can find out which process is causing the problem—perhaps by using one of the methods in Recipe 6.4—you can use pssuspend