From an OS book, I learned that exceptions (such as arithmetic overflow, undefined instructions, invalid memory access) will cause cpu to switch from user mode to kernel mode, so that the OS can handle the exceptions
In high level programming languages, we can catch and handle default (as those mentioned above) or self-defined exceptions in programs, e.g. in C++, by using try
and catch
, and similar constructs in Java and in Python.
I notice that exception handlers are given in user programs in such cases.
With such explicitly catching and handling exceptions in a user program,
will default exceptions still cause cpu to switch from user mode to kernel mode, so that the OS can handle the exceptions?
will self-defined exceptions still cause cpu to switch from user mode to kernel mode, so that the OS can handle the exceptions?
Thanks! (If OS-specificness is needed, then Linux)