Quiz 6
Problem 1 (2 pt)
Consider the following program. User will send a SIGINT signal to the program. In which condition the program may sleep forever?
int sig_int_flag;
main() {
int sig_int();
signal(SIGINT, sig_int);
while (sig_int_flag == 0)
pause();
}
sig_int() {
signal(SIGINT, sig_int);
sig_int_flag = 1;
}
Answer 1
Problem 2 (3 pt)
We can use kill(pid_t pid, int signo)
to send signal to other processes.
Which processes will receive the signal when the pid…
- pid > 0
- pid == 0
- pid < 0