From SUSv4:
If pid is negative, but not -1, sig shall be sent to all processes (excluding an unspecified set of system processes) whose process group ID is equal to the absolute value of pid, and for which the process has permission to send a signal.
As I understand there can't be 2 or more processes with the same PID at any time. Why the spec says to all processes?
Thank you.
The spec says to all processes within the given group. There can be multiple processes per group. The negative id identifies the group.
Process Group ID is different from Process ID.
Assuming that the PID is known, PGID is
Every process is member of a unique process group, identified by its process group ID. (When the process is created, it becomes a member of the process group of its parent.) By convention, the process group ID of a process group equals the process ID of the first member of the process group, called the process group leader. A process finds the ID of its process group using the system call
getpgrp(), or, equivalently,getpgid(0). One finds the process p usinggetpgid(p).
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With