kill() system call and the
kill shell command can be used to kill either processes or process groups. Either way, there is no "cascading", ever.
kill() system call or
kill shell command is given a positive integer, this represents a process. The signal is sent to that process and no others.
kill() system call is given a negative integer or the
kill shell command is given a job identifier beginning with
% (such as
%2), the signal is sent simultaneously to all members of a process group. Process groups are a job control feature. In interactive shell use, each shell pipeline (like
sed s/foo/bar/ | cat -n | gzip) is made up of 1 or more processes that are all part of the same process group.
(For the system call there are a few extra cases:
-1 sends to every process,
0 sends to yourself).
None of this means that when one process dies another process won't also die because of some other reason. For example:
- A process that spawns a child may intercept a termination signal and pass it along to the child it created before itself exiting as a means of cleaning up after itself.
- When an earlier process in a shell pipeline such as the one above dies (for any reason), the later processes in the shell pipeline often promptly terminate as well because they aren't receiving any input anymore.
The kernel isn't responsible at all for such "additional" consequences and they depend on how the software involved behaves.