This preview shows page 1. Sign up to view the full content.
Unformatted text preview: yboard causes a SIGINT signal to be sent to the shell. The shell catches the signal (see Section 8.5.3) and then sends a SIGINT to every process in the foreground process group. In the default case, the result is to terminate the foreground job. Similarly, typing crtl-z sends a SIGTSTP signal to the shell, which catches it and sends a SIGTSTP signal to every process in the foreground process group. In the default case, the result is to stop (suspend) the foreground job. 8.5. SIGNALS 425 pid=10 pgid=10 shell pid=20 pgid=20 foreground job background job #1 pid=32 pgid=32 background job #2 pid=40 pgid=40 child
pid=21 pgid=20 child
pid=22 pgid=20 background process group 32 backgroud process group 40 foreground process group 20 Figure 8.24: Foreground and background process groups. Sending Signals With the kill Function
Processes send signals to other processes (including themselves) by calling the kill function.
#include <sys/types.h> #include <signal.h> int kill(pid t pid, int sig);
returns: 0 if OK, -1 on error If pid is greater than zero, then the kill functio...
View Full Document
- Spring '10
- The American