Signals
Signals are used to notify processes of events/exceptions and are the basis of Inter Process Communication (IPC).
Signals can be sent to processes:
- From the kernel to a user process as a result of a programming error/exception.
- From a user process to the kernel (using a system call) to a user process.
- Only between processes owned by the same user or by the superuser.
Signals are used to handle:
- Exceptions detected by hardware (illegal memory reference).
- Exceptions generated by the environment (user killed process)
kill
can be used to send a signal to processes:
kill 1991
kill -9 1991
kill -SIGKILL 1991
killall
can be used to send signals to multiple processes with a common name pattern:
killall bash
killall -9 bash
killall -SIGTERM bash
pkill
is used to send a signal to processes using specific conditions:
pkill -HUP rsyslogd