|
The getpriority() function obtains the current scheduling priority of a process, process group, or user. The setpriority() function sets the scheduling priority of a process, process group, or user.
Target processes are specified by the values of the which and who arguments. The which argument may be one of the following values: PRIO_PROCESS, PRIO_PGRP, PRIO_USER, PRIO_GROUP, PRIO_SESSION, PRIO_LWP, PRIO_LWP, or PRIO_PROJECT, indicating that the who argument is to be interpreted as a process ID, a process group ID, a user ID, a group ID, a session ID, an
lwp ID, a task ID, or a project ID, respectively. A 0 value for the who argument specifies the current process, process group, or user. A 0 value for the who argument is treated as valid group ID, session ID, lwp ID, task ID, or project ID. A P_MYID value for the who argument can be used to specify the current group, session, lwp, task, or project, respectively.
If more than one process is specified, getpriority() returns the highest priority (lowest numerical value) pertaining to any of the specified processes, and setpriority() sets the priorities of all of the specified processes to the specified value.
The default priority is 0; negative priorities cause more favorable scheduling. While the range of valid priority values is [-20, 20], implementations may enforce more restrictive limits. If the value specified to setpriority() is less than the system's
lowest supported priority value, the system's lowest supported value is used. If it is greater than the system's highest supported value, the system's highest supported value is used.
Only a process with appropriate privileges can raise its priority (that is, assign a lower numerical priority value).
|