A signal is a software notification delivered to a process (for example SIGINT from Ctrl+C, SIGSEGV on an invalid memory access, SIGCHLD when a child exits).
SIGTERM politely asks a process to terminate and can be caught so it can clean up; SIGKILL (signal 9) cannot be caught, blocked or ignored and ends the process immediately without cleanup, so use it as a last resort. SIGSTOP likewise cannot be caught.
Handlers should be short and only use async-signal-safe functions.
Loading…