As mentioned before, each process takes up a certain amount of CPU time. For every moment the CPU is busy running one process, another process loses valuable running time.
As you can imagine, there will be some instances when you are under time constraints and want to prioritize one job over others. Or other times you'll want to push a process back so that it can run quietly in the background while you tend to other things. To control such priorities, we may launch a program with the
nice command, or modify a currently running process with
The term niceness comes from how "nice" the process is, in terms of how much CPU time it hogs. A nice process (as you would imagine) doesn't take too much CPU time and shares the CPU liberally with other processes.
This range of values goes from -20 to 20, where the lower the niceness, the more prioritized the process is. Thus, a "mean" process (one that hogs system resources) would have values close to -20, while a nicer process is closer to 20. The default niceness of any program is 10.
There are several ways you can call on nice:
$ nice -12 python longProgram.py $ nice -n 12 python longProgram.py $ nice --adjustment=12 python longProgram.py
As you can tell, we call nice, then specify any arguments before we input a command.
We can use the renice command to alter the priority of an already running process without disrupting its operation.
$ renice priority [[-p] pids] [[-g] pgrps] [[-u] users]
You may specify a process via its PID with the
-p option. If you want to change the priorities of all processes under a certain group or user, use the
$ renice 5 -p 21649 # Prioritizes the process with pid 21649 $ renice 19 -u SarahMarsh # Deprioritizes all processes belonging to user SarahMarsh
Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.$$ Check price
This book approaches system administration in a practical way and is an invaluable reference for both new administrators and experienced professionals. It details best practices for every facet of system administration, including storage management, network design and administration, email, web hosting, scripting, and much more.$ Check price