start page | rating of books | rating of authors | reviews | copyrights

Unix Power ToolsUnix Power ToolsSearch this book

26.7. Changing a Running Job's Niceness

On Unix systems with BSD-style priority schemes, once a job is running, you can use the renice(8) command to change the job's priority:

% /etc/renice priority-p pid
% /etc/renice priority -g pgrp
% /etc/renice priority -u uname

where priority is the new nice level (Section 26.5) for the job. It must be a signed integer between -20 and 20. pid is the ID number (Section 24.3) (as shown by ps (Section 24.5)) of the process you want to change. pgrp is the number of a process group (Section 24.3), as shown by ps -l; this version of the command modifies the priority of all commands in a process group. uname may be a user's name, as shown in /etc/passwd; this form of the command modifies the priority of all jobs submitted by the user.

A nice level of 19 is the "nicest": the process will run only when nothing else on the system wants to. Negative values make a process get a greater percentage of the CPU's time than the default niceness (which is 0). Again, only the superuser can lower the nice number (raise a process' priority). Users can only raise the nice number (lower the priority), and they can modify the priorities of only the jobs they started.

-- ML



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.