09-Signals_I - CSC 4304 - Systems Programming Fall 2010...

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

View Full Document Right Arrow Icon
1 CSC 4304 - Systems Programming Fall 2010 Tevfik Ko ! ar Louisiana State University September 23rd, 2010 Lecture - IX Signals What is a Signal? • A signal is a software interrupt delivered to a process by the OS because: – it did something (segfault, FPE) – the user did something (pressed ^C) – another process wants to tell it something (SIGUSR?) • Sending a signal is one way a process can communicate with other processes • Some signals is asynchronous, they may be raised at any time (user pressing ^C) • Some signals are directly related to hardware (illegal instruction, arithmetic exception, such as attempt to divide by 0) - synchronous signals 2 Common Signals • SIGHUP (1): hangup - sent to a process when its controlling terminal has disconnected • SIGINT (2): interrupt - Ctrl-C pressed by user • SIGQUIT (3): quit - Ctrl-\ pressed by user • SIGILL (4): Illegal instruction (default core) • SIGABRT (6): Abort process • SIGKILL (9): kill (cannot be caught or ignored) • SIGSEGV (11): Segmentation fault • SIGALRM (14): Alarm cock timeout • SIGUSR[1,2]: User-defined signals • kill –l will list all signals 3 Process Groups 4 Sending Signals 5 Signals from Keyboard 6
Background image of page 1

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

View Full DocumentRight Arrow Icon
Signals from Command-Line 7 Signal Disposition • Ignore the signal (most signals can simply be ignored, except SIGKILL and SIGSTOP) • Handle the signal disposition via a signal handler routine. This allows us to gracefully shutdown a program when the user presses Ctrl-C (SIGINT). • Block the signal. In this case, the OS queues signals for possible later delivery • Let the default apply (usually process termination) 8 Actions on Signal 9 Default Actions 10 Default Signal Actions (BSD) No Name Default Action Description 1 SIGHUP terminate process terminal line hangup 2 SIGINT
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

09-Signals_I - CSC 4304 - Systems Programming Fall 2010...

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

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