So, you’ve just bought a shiny new Apple machine ? It is the fastest machine in the lineup with the max RAM you could afford.
And even that doesn’t stop OS X from throwing that annoying beach ball icon at you right when you’re at your most productive phase of the day?
If the answer to that is yes, read on!
Mac OS X normally is a pretty good multi tasking operating system but like all operating systems, OS X also has it’s limits and while it tries to make maximum use of the RAM and CPU power available to it (and multiple cores, if you’re using a grand central enabled application), there will always be times when you have to face the beach ball.
All current generation of Macs come with a fairly generous amount of RAM so running out of RAM is not that real a problem and if an application still needs to use more RAM than a certain threshold, the operating system’s swap and memory management routines kick in to handle that.
CPU cycles, on the other hand, are always in short supply. If you’re into any kind of multimedia creation or editing, you’d know what I mean.
So, what exactly are your options when an application you’re running starts consuming the CPU like there’s no tomorrow ?
Well, the first option is pretty straightforward. Find the errant application and close it. You can find the CPU usage of all applications by looking at the Activity Monitor.
To kill an application just select it and click the Red Quit Process button. Can’t be easier than that !
The only problem with this approach is that you lose whatever tasks you were doing in that application and there really is no way to get them back unless the application itself has a feature to save your tasks and resume.
But, it turns out that there is another way to deal with this problem.
Mac OS X provides a method by which you can “pause” an application instead of quitting it and then later when you want to get back to it, continue running the application from exactly the point where you left it.
The first thing that you’d need is the process identifier (PID) of the particular process that you want to pause. This is the number given in the first column of the Activity Monitor window. Note down this number. We’ll be using it pretty soon.
Now fire up the Terminal application (From the Applications->Utilities folder) and use the kill command as shown in the screenshot below
Most people think that the Kill command is only used to kill a process on Unix based systems. But, the fact is that this command can be used to send any OS defined signal to an application and STOP is one such signal that Mac OS X defines. What it does is that it stops (or pauses) whatever tasks the applications is performing and takes away control of the CPU from it. Your tasks are still kept in memory and are safe.
kill -STOP <PID>
You can check the status of the process in the Activity Monitor and it should be consuming 0% of the CPU now.
When you’re done with your work and want to get back to the paused process, just use the same kill command to pass another signal, CONT this time, to the process using the same PID that you used earlier.
kill -CONT <PID>
That’s it. You have successfully paused and restarted a process on Mac OS X. You can now happily continue with your work as if nothing ever happened.