Python os.getpgid() Method
Example
Find the process group id of a process id:
#Import os Library
import os
#Get the process id
pid = os.getpid()
#print the process group id
print (os.getpgid(pid))
Try it Yourself »
Definition and Usage
The os.getpgid()
method returns the process group id of a specific process id.
If a process id is 0, this method returns the process group id of the current process.
Note: Available on UNIX platforms only.
Syntax
os.getpgid(pid)
Parameter Values
Parameter | Description |
---|---|
pid | Required. Specifies the process id of the process whose process group id is to be found |
Technical Details
Return Value: | An int value, representing the process group id of
the process with specified process id |
---|---|
Python Version: | 2.3 |