Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

nice(3ucb) [opensolaris man page]

nice(3UCB)					     SunOS/BSD Compatibility Library Functions						nice(3UCB)

NAME
nice - change priority of a process SYNOPSIS
/usr/ucb/cc [ flag ... ] file ... #include<unistd.h> int nice(incr) int incr; DESCRIPTION
The scheduling priority of the process is augmented by incr. Positive priorities get less service than normal. Priority 10 is recommended to users who wish to execute long-running programs without undue impact on system performance. Negative increments are illegal, except when specified by the privileged user. The priority is limited to the range -20 (most urgent) to 20 (least). Requests for values above or below these limits result in the scheduling priority being set to the corresponding limit. The priority of a process is passed to a child process by fork(2). For a privileged process to return to normal priority from an unknown state, nice() should be called successively with arguments -40 (goes to priority -20 because of truncation), 20 (to get to 0), then 0 (to maintain compatibility with previous versions of this call). RETURN VALUES
Upon successful completion, nice() returns 0. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
The priority is not changed if: EPERM The value of incr specified was negative, and the effective user ID is not the privileged user. SEE ALSO
cc(1B), nice(1), renice(1), fork(2), priocntl(2), getpriority(3C) NOTES
Use of these interfaces should be restricted to only applications written on BSD platforms. Use of these interfaces with any of the system libraries or in multi-threaded applications is unsupported. SunOS 5.11 30 Oct 2007 nice(3UCB)

Check Out this Related Man Page

NICE(P) 						     POSIX Programmer's Manual							   NICE(P)

NAME
nice - change the nice value of a process SYNOPSIS
#include <unistd.h> int nice(int incr); DESCRIPTION
The nice() function shall add the value of incr to the nice value of the calling process. A process' nice value is a non-negative number for which a more positive value shall result in less favorable scheduling. A maximum nice value of 2*{NZERO}-1 and a minimum nice value of 0 shall be imposed by the system. Requests for values above or below these limits shall result in the nice value being set to the corresponding limit. Only a process with appropriate privileges can lower the nice value. Calling the nice() function has no effect on the priority of processes or threads with policy SCHED_FIFO or SCHED_RR. The effect on pro- cesses or threads with other scheduling policies is implementation-defined. The nice value set with nice() shall be applied to the process. If the process is multi-threaded, the nice value shall affect all system scope threads in the process. As -1 is a permissible return value in a successful situation, an application wishing to check for error situations should set errno to 0, then call nice(), and if it returns -1, check to see whether errno is non-zero. RETURN VALUE
Upon successful completion, nice() shall return the new nice value -{NZERO}. Otherwise, -1 shall be returned, the process' nice value shall not be changed, and errno shall be set to indicate the error. ERRORS
The nice() function shall fail if: EPERM The incr argument is negative and the calling process does not have appropriate privileges. The following sections are informative. EXAMPLES
Changing the Nice Value The following example adds the value of the incr argument, -20, to the nice value of the calling process. #include <unistd.h> ... int incr = -20; int ret; ret = nice(incr); APPLICATION USAGE
None. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
getpriority() , setpriority() , the Base Definitions volume of IEEE Std 1003.1-2001, <limits.h>, <unistd.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 NICE(P)
Man Page