Unix Signal - Sending Signals

Sending Signals

  • Typing certain key combinations at the controlling terminal of a running process causes the system to send it certain signals:
    • Ctrl-C (in older Unixes, DEL) sends an INT signal (SIGINT); by default, this causes the process to terminate.
    • Ctrl-Z sends a TSTP signal (SIGTSTP); by default, this causes the process to suspend execution.
    • Ctrl-\ sends a QUIT signal (SIGQUIT); by default, this causes the process to terminate and dump core.
    • (Those default key combinations can be changed with the stty command.)
  • The kill(2) system call will send the specified signal to the process, if permissions allow. Similarly, the kill(1) command allows a user to send signals to processes. The raise(3) library function sends the specified signal to the current process.
  • Exceptions such as division by zero or a segmentation violation will generate signals (here, SIGFPE and SIGSEGV respectively, which both by default cause a core dump and a program exit).
  • The kernel can generate a signal to notify the process of an event. For example, SIGPIPE will be generated when a process writes to a pipe which has been closed by the reader; by default, this causes the process to terminate, which is convenient when constructing shell pipelines.

Read more about this topic:  Unix Signal

Famous quotes containing the words sending and/or signals:

    When our kids are young, many of us rush out to buy a cute little baby book to record the meaningful events of our young child’s life...But I’ve often thought there should be a second book, one with room to record the moral milestones of our child’s lives. There might be space to record dates she first shared or showed compassion or befriended a new student or thought of sending Grandma a get-well card or told the truth despite its cost.
    Fred G. Gosman (20th century)

    The term preschooler signals another change in our expectations of children. While toddler refers to physical development, preschooler refers to a social and intellectual activity: going to school. That shift in emphasis is tremendously important, for it is at this age that we think of children as social creatures who can begin to solve problems.
    Lawrence Kutner (20th century)