6 added 2 characters in body
source | link

When sending a signal to PID 0 (zero), the signal is delivered to all processes that are members of the same process group as the sender. A process group other than the current one may be signalled with kill(-PGID) (or kill -- -PGID in the shell) where PGID is the process group ID.

The process group of a PID is returned by getpgid() function, and the process group of the current process may be found with getpgrp().

In the shell, you may use

$ ps -opid,pgid,command

to get the PID, PGID (process group ID) and command line of your current session.

This may return something like

  PID  PGID COMMAND
20716 20716 -ksh93 (ksh93)
83662 83662 -ksh93 (ksh93)
 4322  4322 /usr/X11R6/bin/xclock
 5374  5374 tmux: client (/tmp/tmux-11000/default) (tmux)
78747 78747 -ksh93 (ksh93)
29298 29298 ps -opid
63563 63563 -ksh93 (ksh93)
63327 63327 mutt
21790 21790 -ksh93 (ksh93)
64493 64493 /bin/sh /usr/X11R6/bin/startx
14485 64493 xinit /home/kk/.xinitrc -- /usr/X11R6/bin/X :0 -auth /home/kk/.serverauth.E3cwuT5FZR
93531 93531 sh /home/kk/.xinitrc
48598 93531 flwm
28154 93531 xterm
73053 93531 xterm

After a clarification of the question:

The purposepurpose of a process group is to be able to send a signal to all its members without knowing the process IDs of each individual member.

Without a process group concept, one would have to get all the processes on the system, figure out how they are related (using the parent process IDs) and iterate over the relevant processes, sending each the signal.

The kernel does this, but it knows and keeps track of process groups, so it will never have to iterate over all processes to send a signal to a process group, only over the members of the group.

Since the process group ID is exposed to the user, one would only have to query one process for its process group ID before being able to send a signal to all processes in that group.

When sending a signal to PID 0 (zero), the signal is delivered to all processes that are members of the same process group as the sender. A process group other than the current one may be signalled with kill(-PGID) (or kill -- -PGID in the shell) where PGID is the process group ID.

The process group of a PID is returned by getpgid() function, and the process group of the current process may be found with getpgrp().

In the shell, you may use

$ ps -opid,pgid,command

to get the PID, PGID (process group ID) and command line of your current session.

This may return something like

  PID  PGID COMMAND
20716 20716 -ksh93 (ksh93)
83662 83662 -ksh93 (ksh93)
 4322  4322 /usr/X11R6/bin/xclock
 5374  5374 tmux: client (/tmp/tmux-11000/default) (tmux)
78747 78747 -ksh93 (ksh93)
29298 29298 ps -opid
63563 63563 -ksh93 (ksh93)
63327 63327 mutt
21790 21790 -ksh93 (ksh93)
64493 64493 /bin/sh /usr/X11R6/bin/startx
14485 64493 xinit /home/kk/.xinitrc -- /usr/X11R6/bin/X :0 -auth /home/kk/.serverauth.E3cwuT5FZR
93531 93531 sh /home/kk/.xinitrc
48598 93531 flwm
28154 93531 xterm
73053 93531 xterm

After a clarification of the question:

The purpose of a process group is to be able to send a signal to all its members without knowing the process IDs of each individual member.

Without a process group concept, one would have to get all the processes on the system, figure out how they are related (using the parent process IDs) and iterate over the relevant processes, sending each the signal.

The kernel does this, but it knows and keeps track of process groups, so it will never have to iterate over all processes to send a signal to a process group, only over the members of the group.

Since the process group ID is exposed to the user, one would only have to query one process for its process group ID before being able to send a signal to all processes in that group.

When sending a signal to PID 0 (zero), the signal is delivered to all processes that are members of the same process group as the sender. A process group other than the current one may be signalled with kill(-PGID) (or kill -- -PGID in the shell) where PGID is the process group ID.

The process group of a PID is returned by getpgid() function, and the process group of the current process may be found with getpgrp().

In the shell, you may use

$ ps -opid,pgid,command

to get the PID, PGID (process group ID) and command line of your current session.

This may return something like

  PID  PGID COMMAND
20716 20716 -ksh93 (ksh93)
83662 83662 -ksh93 (ksh93)
 4322  4322 /usr/X11R6/bin/xclock
 5374  5374 tmux: client (/tmp/tmux-11000/default) (tmux)
78747 78747 -ksh93 (ksh93)
29298 29298 ps -opid
63563 63563 -ksh93 (ksh93)
63327 63327 mutt
21790 21790 -ksh93 (ksh93)
64493 64493 /bin/sh /usr/X11R6/bin/startx
14485 64493 xinit /home/kk/.xinitrc -- /usr/X11R6/bin/X :0 -auth /home/kk/.serverauth.E3cwuT5FZR
93531 93531 sh /home/kk/.xinitrc
48598 93531 flwm
28154 93531 xterm
73053 93531 xterm

After a clarification of the question:

The purpose of a process group is to be able to send a signal to all its members without knowing the process IDs of each individual member.

Without a process group concept, one would have to get all the processes on the system, figure out how they are related (using the parent process IDs) and iterate over the relevant processes, sending each the signal.

The kernel does this, but it knows and keeps track of process groups, so it will never have to iterate over all processes to send a signal to a process group, only over the members of the group.

Since the process group ID is exposed to the user, one would only have to query one process for its process group ID before being able to send a signal to all processes in that group.

5 added 805 characters in body
source | link

When sending a signal to PID 0 (zero), the signal is delivered to all processes that are members of the same process group as the sender. A process group other than the current one may be signalled with kill(-PGID) (or kill -- -PGID in the shell) where PGID is the process group ID.

The process group of a PID is returned by getpgid() function, and the process group of the current process may be found with getpgrp().

In the shell, you may use

$ ps -opid,pgid,command

to get the PID, PGID (process group ID) and command line of your current session.

This may return something like

  PID  PGID COMMAND
20716 20716 -ksh93 (ksh93)
83662 83662 -ksh93 (ksh93)
 4322  4322 /usr/X11R6/bin/xclock
 5374  5374 tmux: client (/tmp/tmux-11000/default) (tmux)
78747 78747 -ksh93 (ksh93)
29298 29298 ps -opid
63563 63563 -ksh93 (ksh93)
63327 63327 mutt
21790 21790 -ksh93 (ksh93)
64493 64493 /bin/sh /usr/X11R6/bin/startx
14485 64493 xinit /home/kk/.xinitrc -- /usr/X11R6/bin/X :0 -auth /home/kk/.serverauth.E3cwuT5FZR
93531 93531 sh /home/kk/.xinitrc
48598 93531 flwm
28154 93531 xterm
73053 93531 xterm

After a clarification of the question:

The purpose of a process group is to be able to send a signal to all its members without knowing the process IDs of each individual member.

Without a process group concept, one would have to get all the processes on the system, figure out how they are related (using the parent process IDs) and iterate over the relevant processes, sending each the signal.

The kernel does this, but it knows and keeps track of process groups, so it will never have to iterate over all processes to send a signal to a process group, only over the members of the group.

Since the process group ID is exposed to the user, one would only have to query one process for its process group ID before being able to send a signal to all processes in that group.

When sending a signal to PID 0 (zero), the signal is delivered to all processes that are members of the same process group as the sender. A process group other than the current one may be signalled with kill(-PGID) (or kill -- -PGID in the shell) where PGID is the process group ID.

The process group of a PID is returned by getpgid() function, and the process group of the current process may be found with getpgrp().

In the shell, you may use

$ ps -opid,pgid,command

to get the PID, PGID (process group ID) and command line of your current session.

This may return something like

  PID  PGID COMMAND
20716 20716 -ksh93 (ksh93)
83662 83662 -ksh93 (ksh93)
 4322  4322 /usr/X11R6/bin/xclock
 5374  5374 tmux: client (/tmp/tmux-11000/default) (tmux)
78747 78747 -ksh93 (ksh93)
29298 29298 ps -opid
63563 63563 -ksh93 (ksh93)
63327 63327 mutt
21790 21790 -ksh93 (ksh93)
64493 64493 /bin/sh /usr/X11R6/bin/startx
14485 64493 xinit /home/kk/.xinitrc -- /usr/X11R6/bin/X :0 -auth /home/kk/.serverauth.E3cwuT5FZR
93531 93531 sh /home/kk/.xinitrc
48598 93531 flwm
28154 93531 xterm
73053 93531 xterm

When sending a signal to PID 0 (zero), the signal is delivered to all processes that are members of the same process group as the sender. A process group other than the current one may be signalled with kill(-PGID) (or kill -- -PGID in the shell) where PGID is the process group ID.

The process group of a PID is returned by getpgid() function, and the process group of the current process may be found with getpgrp().

In the shell, you may use

$ ps -opid,pgid,command

to get the PID, PGID (process group ID) and command line of your current session.

This may return something like

  PID  PGID COMMAND
20716 20716 -ksh93 (ksh93)
83662 83662 -ksh93 (ksh93)
 4322  4322 /usr/X11R6/bin/xclock
 5374  5374 tmux: client (/tmp/tmux-11000/default) (tmux)
78747 78747 -ksh93 (ksh93)
29298 29298 ps -opid
63563 63563 -ksh93 (ksh93)
63327 63327 mutt
21790 21790 -ksh93 (ksh93)
64493 64493 /bin/sh /usr/X11R6/bin/startx
14485 64493 xinit /home/kk/.xinitrc -- /usr/X11R6/bin/X :0 -auth /home/kk/.serverauth.E3cwuT5FZR
93531 93531 sh /home/kk/.xinitrc
48598 93531 flwm
28154 93531 xterm
73053 93531 xterm

After a clarification of the question:

The purpose of a process group is to be able to send a signal to all its members without knowing the process IDs of each individual member.

Without a process group concept, one would have to get all the processes on the system, figure out how they are related (using the parent process IDs) and iterate over the relevant processes, sending each the signal.

The kernel does this, but it knows and keeps track of process groups, so it will never have to iterate over all processes to send a signal to a process group, only over the members of the group.

Since the process group ID is exposed to the user, one would only have to query one process for its process group ID before being able to send a signal to all processes in that group.

4 added 153 characters in body
source | link

When sending a signal to PID 0 (zero), the signal is delivered to all processes that are members of the same process group as the sender. A process group other than the current one may be signalled with kill(-PGID) (or kill -- -PGID in the shell) where PGID is the process group ID.

The process group of a PID is returned by getpgid() function, and the process group of the current process may be found with getpgrp().

In the shell, you may use

$ ps -opid,pgid,command

to get the PID, PGID (process group ID) and command line of your current session.

This may return something like

  PID  PGID COMMAND
20716 20716 -ksh93 (ksh93)
83662 83662 -ksh93 (ksh93)
 4322  4322 /usr/X11R6/bin/xclock
 5374  5374 tmux: client (/tmp/tmux-11000/default) (tmux)
78747 78747 -ksh93 (ksh93)
29298 29298 ps -opid
63563 63563 -ksh93 (ksh93)
63327 63327 mutt
21790 21790 -ksh93 (ksh93)
64493 64493 /bin/sh /usr/X11R6/bin/startx
14485 64493 xinit /home/kk/.xinitrc -- /usr/X11R6/bin/X :0 -auth /home/kk/.serverauth.E3cwuT5FZR
93531 93531 sh /home/kk/.xinitrc
48598 93531 flwm
28154 93531 xterm
73053 93531 xterm

When sending a signal to PID 0 (zero), the signal is delivered to all processes that are members of the same process group as the sender.

The process group of a PID is returned by getpgid() function, and the process group of the current process may be found with getpgrp().

In the shell, you may use

$ ps -opid,pgid,command

to get the PID, PGID (process group ID) and command line of your current session.

This may return something like

  PID  PGID COMMAND
20716 20716 -ksh93 (ksh93)
83662 83662 -ksh93 (ksh93)
 4322  4322 /usr/X11R6/bin/xclock
 5374  5374 tmux: client (/tmp/tmux-11000/default) (tmux)
78747 78747 -ksh93 (ksh93)
29298 29298 ps -opid
63563 63563 -ksh93 (ksh93)
63327 63327 mutt
21790 21790 -ksh93 (ksh93)
64493 64493 /bin/sh /usr/X11R6/bin/startx
14485 64493 xinit /home/kk/.xinitrc -- /usr/X11R6/bin/X :0 -auth /home/kk/.serverauth.E3cwuT5FZR
93531 93531 sh /home/kk/.xinitrc
48598 93531 flwm
28154 93531 xterm
73053 93531 xterm

When sending a signal to PID 0 (zero), the signal is delivered to all processes that are members of the same process group as the sender. A process group other than the current one may be signalled with kill(-PGID) (or kill -- -PGID in the shell) where PGID is the process group ID.

The process group of a PID is returned by getpgid() function, and the process group of the current process may be found with getpgrp().

In the shell, you may use

$ ps -opid,pgid,command

to get the PID, PGID (process group ID) and command line of your current session.

This may return something like

  PID  PGID COMMAND
20716 20716 -ksh93 (ksh93)
83662 83662 -ksh93 (ksh93)
 4322  4322 /usr/X11R6/bin/xclock
 5374  5374 tmux: client (/tmp/tmux-11000/default) (tmux)
78747 78747 -ksh93 (ksh93)
29298 29298 ps -opid
63563 63563 -ksh93 (ksh93)
63327 63327 mutt
21790 21790 -ksh93 (ksh93)
64493 64493 /bin/sh /usr/X11R6/bin/startx
14485 64493 xinit /home/kk/.xinitrc -- /usr/X11R6/bin/X :0 -auth /home/kk/.serverauth.E3cwuT5FZR
93531 93531 sh /home/kk/.xinitrc
48598 93531 flwm
28154 93531 xterm
73053 93531 xterm
3 added 756 characters in body
source | link
2 added 756 characters in body
source | link
1
source | link