List at least five common signals defined in the signal.h header file and describe their typical use or effect on a process. How does the system handle these signals if the process has not set up a custom signal handler?
The five common signals that can be found in the signal.h header file are:-
SIGINT: Interrupt from keyboard(ctrl+C). This signal sends an interrupt and stops the program.
SIGQUIT: Quit from keyboard(ctrl+\). This signal results in core dump.
SIGTSTP: This works as if stop is typed on the terminal.(ctrl+Z).
SIGABRT: Abort signal from abort() function.
SIGFPE: Floating Point Exception.
If the process hasn't set up any custom signal handler then the system handles these signals as:-
User Interrupts:- When the user wants to terminate a process it can terminate by pressing any of these: ctrl+C,ctrl+Z,ctrl+\. The process handles this signal by cleaning up resources and exiting gracefully.
Process Control: One process can control another by sending signals. For example, the parent process can send the SIGKILL signal to the child process to forcefully terminate it.
Timers: Processes can set up timers to perform actions at specific intervals.