Open System Services System Calls Reference Manual (G06.25+, H06.03+)
nice(2) OSS System Calls Reference Manual
NAME
nice - Changes the scheduling priority of the calling process
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
int nice(
int increment);
PARAMETERS
increment Specifies a value that is added to the current nice value of the calling process.
The nice value of the calling process is maintained by the system and affects the
scheduling priority of the process. Increasing the nice value lowers the schedul-
ing priority of the process. Decreasing the nice value increases the scheduling
priority of the process.
If the value specified for increment increases the nice value of the calling pro-
cess such that it exceeds the maximum value possible for nice, nice is set to its
maximum value.
A negative value can be specified for increment if the process has appropriate
privileges.
If the value specified for increment decreases the nice value of the calling pro-
cess such that it becomes less than the minimum value possible for nice, nice is
set to its minimum value.
DESCRIPTION
The nice() function increases or decreases the nice value of the calling process.
The nice value is a nonnegative number in the range 0 through (2*NZERO -1). NZERO is
defined in the limits.h header file.
The nice value is a relative value for scheduling priority among executing processes. The nice
value of a parent process is passed to a child process during a call to the fork(), tdm_fork(),
tdm_spawn(), and tdm_spawnp() functions. The nice value of a calling process is passed to a
new process image during a call to any of the exec or tdm_exec sets of functions.
The nice value is an attribute of a process in both the Guardian and OSS environments. The
default value of nice for a newly created process is the value defined for NZERO in the limits.h
header file. The nice value affects scheduling priority but does not determine scheduling prior-
ity.
Use on Guardian Objects
The nice() function can only be used by a process on itself.
The Guardian priority of a process after a call to the nice() function is calculated as follows:
New Guardian priority = old Guardian priority
- (new nice value - old nice value)
which is the same as:
New Guardian priority = old Guardian priority
- ((old nice value + increment) - old nice value)
5−2 Hewlett-Packard Company 527186-003