Python os.getpriority() Method
Example
Get the scheduling priority of a process:
#Import os Library
import os
#get a process id
pId=os.getpid()
#set scheduling prority to a process
os.setpriority(os.PRIO_PROCESS, pId, 12)
#print the current scheduling priority of a process
print (os.getpriority(os.PRIO_PROCESS, pId))
Definition and Usage
The os.getpriority()
method returns the scheduling priority of a process, process group, or user.
Note: This method is available on UNIX platforms only.
Syntax
os.getpriority(which, who)
Parameter Values
Parameter | Description |
---|---|
which |
Required. Defines the priority of a process, process group or user. Can be one of the following values:
|
who | Required. Defines an id whose scheduling priority is to be found. This can be a process id, process group id or a user id |
Technical Details
Return Value: | An int value, representing the scheduling priority of a process, process group, or user
|
---|---|
Python Version: | 3.3 |