My understanding is as follows.
- The program raises runtime errors (e.g., division by zero, or invalid memory reference)
- The program executes 'fault' instruction and give control to the kernel
- The kernel determines that it is not recoverable like page fault, so it sends the proper signal to the process (e.g., SIGFPE / SIGSEGV)
- The process receives the signal and exits itself.
If the operations described above makes sense, I don't understand the designs or rationales for the process above. In my understanding the program at first place know that it is an obvious error (at the step 1 - before it gave its control to the kernel). Then, why does the process not exit at that time but rather do some operations? (step 2-4)