Conditions to Generate Signals

Terminal-Generated Signals

因為使用者用 terminal 介入產生的 signal,e.g. Ctrl + C

Signals for Exceptions

自己程式寫爛了在跑時產生的 signal,e.g.

  • segmentation fault SIGFPE(8)
  • divided by 0 SIGSEGV(11)

Function Kill

某個 process 內部用 kill() system call 去向其他 process 發 signal

Shell Command Kill

從 shell 用指令發送的 signal,e.g. kill -9 pid (SIGKILL)

Signals because of Software Conditions

由 kernel 偵測到特定狀況時自動發送的,e.g.

  • pipe read 端沒有人在讀你在 write 端寫:SIGPIPE
  • alarm clock 結束了:SIGALRM