DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

nice(S)


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, unless the calling process has the P_TSHAR privilege.

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 calling process does not have the P_TSHAR privilege.

EINVAL
The process was in a scheduling class other than time-sharing.

Usage

priocntl(S) is a more general interface to scheduler functions.

References

exec(S), nice(C), priocntl(S)

Notices

Considerations for threads programming

The nice system call should not be used to modify the priority of threads. See thr_setprio(THREAD).

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.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005