nice(2) nice(2)
NAME
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).
Copyright 1994 Novell, Inc. Page 1
nice(2) nice(2)
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.
Copyright 1994 Novell, Inc. Page 2