NICE
If you start a process that
will take long to execute and is heavy on CPU resources, it may be a
good thing to let it run in the background ( so you can continue doing
other things ) and change the priority of the process.
With adding a
"nice" value before the command you can set the priority . . . and
closing the command with an "&" you set it to the background and
thus will get your prompt back so you can continue working.
This Tip is about "nice", but we will handle forground and background
processes more extensively in the next Tip.
So let us give a simple example:
| CODE |
| #
nice -n 19 updatedb & |
Here
the nice priority is set to 19 ( its lowest value ) . . . You will see
the command returns "[1] 8037" in your terminal, this is because
"&" did place the process in the background, the "[1]" is the job
number and the "8037" the process number. But like I said, more about
that next time.
If you want you process to have the highest
priority ( so to be less "nice" to other processes ) you can go up to
-20 ( the highest value ) so the process will finish quick:
| CODE |
| #
nice -n -20 updatedb & |

Bruno
-- Sep 13 2005 ( Revised Dec 10 2005 ) --