some commonly used signals and their typical
purposes:
SIGINT (Ctrl+C):
Purpose: Interrupt signal. Typically used to request the termination of a process by
the user.
How to Give Input: Pressing Ctrl+C in the terminal where the process is running
sends the SIGINT signal to the foreground process.
SIGTERM:
Purpose: Termination signal. Used to request the graceful termination of a process.
How to Give Input: You can send the SIGTERM signal to a process using the kill
command in the terminal, specifying the process ID (PID) of the target process. For
example: kill <PID>.
SIGKILL:
Purpose: Kill signal. Used to forcefully terminate a process.
How to Give Input: Similar to SIGTERM, you can send the SIGKILL signal using the
kill command. However, unlike SIGTERM, SIGKILL cannot be caught or ignored by the
process.
SIGUSR1 and SIGUSR2:
Purpose: User-defined signals. These signals have no predefined meaning and can
be used by applications for custom purposes.
How to Give Input: Similar to SIGTERM, you can send SIGUSR1 or SIGUSR2 using
the kill command. Additionally, these signals can be raised programmatically within a
process using functions like raise().
SIGALRM:
Purpose: Alarm signal. Used to set a timer and receive a notification when the timer
expires.
How to Give Input: You can set an alarm timer using the alarm() function in a
program, specifying the duration in seconds. When the timer expires, the process receives
a SIGALRM signal.
SIGCHLD:
Purpose: Child status change signal. Sent to the parent process when a child process
terminates or stops.
How to Give Input: This signal is automatically generated by the operating system
when child processes change state. Parent processes typically handle this signal to
perform cleanup or other actions related to child processes.