Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
nice - change priority of process
&pagelevel(4)&pagelevel
Syntax | #include <unistd.h> int nice(int incr); |
Description | nice() adds the value of incr to the nice value of the calling process. Note that in the C runtime system, changing the nice value with incr has no effect on the priority of a process. The function is supported only for conformance with XPG4.
A process nice value is a non-negative integer for which a more positive value results in lower CPU priority. A maximum nice value of 2*{NZERO }-1 and a minimum nice value of 0 are imposed by the system. Requests for values above or below these limits result in the nice value being set to the corresponding limit. Only a process with appropriate privileges can lower the nice value. If threads are used, then the function affects the process or a thread in the following manner: Changes the priority of a process. If the process is multithreaded, the scheduling priority affects all threads of the process throughout the scope of the system. |
Return val. | New nice value minus {NZERO} |
| upon successful completion. |
-1 | if an error occurs. The process nice value is not changed, and errno is set to indicate the error. |
Errors | nice() will fail if:
|
| EPERM
| incr is negative or greater than 2*{NZERO} -1, and the calling process does not have appropriate privileges. |
Notes | 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 if errno is non-zero. |
See also | limits.h , unistd.h .
|