A user level process in Unix traps the signal sent on a Ctrl-C input, and has…

2005

A user level process in Unix traps the signal sent on a Ctrl-C input, and has a signal handling routine that saves appropriate files before terminating the process. When a Ctrl-C input is given to this process, what is the mode in which the signal handling routine executes?

  1. A.

    kernel mode

  2. B.

    superuser mode

  3. C.

    privileged mode

  4. D.

    user mode

Attempted by 730 students.

Show answer & explanation

Correct answer: D

Answer: user mode

Explanation:

  • When Ctrl-C is pressed, the terminal driver generates the SIGINT signal and the kernel delivers that signal to the foreground process or process group.

  • The kernel executes in kernel mode to perform delivery work: it records the signal, arranges the process stack and registers so the handler can be invoked, and updates process state.

  • After preparing delivery, the kernel resumes the process in user mode; the user-defined signal handling routine runs in that user-mode context.

  • Thus, although the kernel is involved in delivering the signal, the signal handler itself executes in user mode.

Explore the full course: Gate Guidance By Sanchit Sir