And when I checked CPU usage and ordered the processes displayed by CPU usage percentage by clicking on the % CPU column header, I saw that Firefox was using about 100% of the CPU cycles. Firefox eventually got to the point where the Activity Monitor showed a status of "Not Responding" next to its process name.
I didn't want to kill the Firefox process, which I could have done by double-clicking on the Firefox entry in Activity Monitor and then clicking on the Quit button in the process details window, but I needed to make the system more responsive so I could complete some pressing tasks. So I decided to suspend the process temporarily so that it was no longer taxing the system with the number of CPU cycles it was consuming.
You can suspend/pause a process, so that it can be resumed later, from a
command line interface, i.e., the Bash shell prompt you can obtain by running
the
Terminal application found in Applications/Utilities, using the
kill command with the -STOP
option. The format for the command is kill -STOP PID
,
where PID is the
process identifier (PID) for the process. You
can obtain the PID for a process from the PID column in Activity Monitor
or from the command line by using ps aux
followed by a grep command to filter the output
of the ps command by the relevant
process name, which in this case is "firefox":
$ ps aux | grep firefox | grep -v grep jasmith1 509 100.5 23.0 13283344 3859620 ?? R 5May16 8271:32.53 /Applications/Firefox.app/Contents/MacOS/firefox -psn_0_45067
The PID is shown in the second column of the output; the CPU utilization is shown as a percentage in the third column. Since the PID was 509 in this case, I could stop Firefox temporarily with the command below:
$ kill -STOP 509 $
The CPU usage displayed by Activity Monitor then declined considerably and Firefox no longer appeared at the top of the list of processes when I had them ordered by CPU utilization. But, when I sorted by process name by clicking on the Process Name column header, I could see that Activity Monitor still had it listed, but with 0 percent CPU usage now.
The memory utilization remained similar to what it had been before when the program was running, however.
I could still see it listed when I issued the ps aux
command,
also, but the CPU usage shown in the third column was now at 0.0.
$ ps aux | grep firefox | grep -v grep jasmith1 509 0.0 22.9 13316048 3848612 ?? T 5May16 8298:16.00
I could resume the process functioning using the -CONT
parameter for the kill command in place of the -STOP
I had
used previously. I.e., I could start it again with the command below:
$ kill -CONT 509 $
Of course, that resulted in the process returning to its excessive CPU usage.