nice(2)
nice --
change priority of a time-sharing process
Synopsis
#include <unistd.h>
int nice(int incr);
Description
nice
allows a member of the time-sharing scheduling class to change its priority.
nice
adds the value of
incr
to the nice value of the calling process.
The nice value
is a non-negative number for which a more positive value
results in lower
CPU
priority.
A maximum nice value of
39 and a minimum nice value of 0
are imposed by the system.
(The default nice value is 20.)
Requests for values above or below these limits
result in the nice value being set to the corresponding limit.
Return values
On success, nice returns the new nice value minus
20.
On failure, nice returns -1 and sets errno to identify the error.
Errors
In the following conditions, nice fails and sets errno to:
- EPERM
-
incr is negative or greater than
39
and the effective user ID of the calling process does not have the appropriate
privilege.
(P_TSHAR)
- EINVAL
-
The process was in a scheduling class other than time-sharing.
Usage
priocntl(2)
is a more general interface to scheduler functions.
References
exec(2),
nice(1),
priocntl(2)
Notices
Considerations for threads programming
The nice system call should not be used to modify the priority of threads.
See
thr_setprio(3thread).
Considerations for lightweight processes
Scheduling context is not a process attribute,
a separate context is internally maintained for each LWP.
A call to nice shall bias only the priority of
the calling LWP by the applied nice value.
A process can contain LWPs belonging to different scheduling classes.
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.