PGIDs
PGIDs stands for process group identifiers. In Unix-like operating systems, every process has a process ID (PID) and belongs to a process group identified by a PGID. A process group is a collection of one or more related processes that can receive signals as a single unit. By convention, the PGID is usually the PID of the group leader, which is the first process in the group to form the group.
Process groups are organized within sessions. A session contains one or more process groups and has a
- A process can create or join a group using setpgid; if a process calls setpgid(0, pid), it
- The current process’s group can be queried with getpgrp(), getpgid(0), or similar calls.
- A terminal can designate a foreground process group with tcsetpgrp, enabling keyboard input and job control
- Signals can be sent to an entire group by using a negative PGID in system calls like
- Walls and shells commonly use PGIDs to manage pipelines, foregrounding, stopping (Ctrl-Z), and resuming jobs.
PGIDs are a core part of Unix process management and are primarily relevant to system programming, shells,