How do exceptions work from an Operating System's perspective?

Coming from C++, I can understand exceptions from a programmer's perspective.
When an exception gets thrown, the stack begins to unwind, and each activation record has the opportunity to catch and handle the exception.

But whose responsibility was it to throw the exception in the first place?

  1. Is it the Operating System that sends a trigger to the process telling it to enter it's "exception handling state?"
  2. Is the process invoking and handling exceptions in it's own program space, unpronounced to the OS?

Here are two crashing programs that illustrate my uncertainty.

int main(){

    int i = 1/0; //did the OS tell the process to end?

    return 0;
}

#include <exception>

int main(){

    throw 11;  //did the process tell the OS it needs to end?

    return 0;
}
Edit
Report