Role-specific Signal Handling Interview Questions & Answers:
b) Send a signal to a process
a) the string "Linux" will print
Explanation:
The signal handler function "response" executes after recieving the signal SIGINT.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
google
google
google
^CLinux
google
google
^CLinux
google
google
^CLinux
google
^Z
[2]+ Stopped ./san
[root@localhost google]#
c) process will never terminate
Explanation:
According to the signal handler function of this program as the SIGINT signal arrives second time, the signal performs its default operation i.e. termination of the process.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
google
google
^CLinux
google
^C
[root@localhost google]#
c) both child and parent process ignores the signal
Explanation:
If a process ignores a signal then by default its child also ignores that signal.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
Parent Process
Child Process
Child Process
^CChild Process
^CChild Process
^CChild Process
^Z
[3]+ Stopped ./san
[root@localhost signal]#
a) Interrupt
Explanation:
The messages associated with signals can be access by the function sys_siglist().
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
google
google
google
^CInterruptgoogle
google
^CInterruptgoogle
google
^CInterruptgoogle
google
google
^Z
[4]+ Stopped ./san
[root@localhost google]#
https://InterviewQuestionsAnswers.ORG.