Lec14-IPC Unix Case Study-Signals

Lec14-IPC Unix Case Study-Signals - 1 Reference Reference...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Reference Reference • “Introduction To Unix Signals Programming” • Man page – sigprocmask, alarm • “Understanding the Linux Kernel” (Oreilly) 2 Signal: An IPC Mechanism Signal: An IPC Mechanism • With pipes we communicated data • With signal, we can communicate control command • The only information is: The number identifying the signal • Interrupts a process and forces it to handle the event immediately • kill –l can be used to view all the signals supported by your system 3 Sending signals to process Sending signals to process • From keyboard Ctrl-C, Ctrl-Z etc • From the command line kill -<signal> <PID> fg • Using the kill() system call • Also used by the kill and fg command #include <signal.h> /* signal name macros, and the kill() prototype */ /* first, find my own process ID */ pid_t my_pid = getpid(); /* now that i got my PID, send myself the STOP signal. */ kill(my_pid, SIGSTOP); 4 Actions Performed upon Actions Performed upon Receiving a Signal Receiving a Signal • There are three ways in which a process can respond to a signal: 1. Explicitly ignore the signal. 2. Execute the default action associated with the signal. 3. Catch the signal by invoking a corresponding signal-handler function. 5 Signal Handler Signal Handler • Corresponding to each signal is a signal handler • Called when a process receives a signal • The function is called “asynchronously” • When the signal handler returns the process continues, as if it was never interrupted • Signal are different from interrupts as: Interrupts are sent to OS by H/W Signals are sent to a process by the OS, or by other processes Note that signals have nothing to do with software interrupts 6 Catching a Signal Catching a Signal 7 The The signal() signal() System Call System Call • Used to set signal handler for a signal type 8...
View Full Document

This note was uploaded on 01/23/2011 for the course COE 10001 taught by Professor Abad during the Spring '09 term at Alfaisal University.

Page1 / 22

Lec14-IPC Unix Case Study-Signals - 1 Reference Reference...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online