In this section, we shall discuss in detail how exactly signals are handled by the application developer programmatically (using C code, of course).
Glance back at Figure 1.You can see how the OS performs default signal handling, which runs when an uncaught signal is delivered to the process. This seems good, until we realize that, pretty often, the default action is to simply kill (or terminate) the process. What if the application demands we do something else? Or, what if, realistically, the application does crash, instead of just abruptly dying (and perhaps leaving important files and other metadata in an inconsistent state). Perhaps we can put the program into a sane state by performing some required cleanup, flushing buffers, closing open files, logging the state/debug information, and so on, informing the user of the sorry state of affairs (with a nice dialog...