recategorized by
11,246 views
43 votes
43 votes
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. User mode
  2. Kernel mode
  3. Superuser mode
  4. Privileged mode
recategorized by

7 Answers

1 votes
1 votes

Answer = Kernel mode.
Explanation.
Hardware interrupts (also called external/asynchronous interrupts), are ones in which the notification originates from a hardware device such as a keyboard, mouse , etc.
The most common way of sending signals to processes is using the keyboard:
• Ctrl-C: Causes the system to send an INT signal (SIGINT) to the running process.
• Ctrl-Z: causes the system to send a TSTP signal (SIGTSTP) to the running process.
The kernel handles signals in the context of the process that receives them, so
a process must run to handle signals.

1 votes
1 votes
The question says "signal handling routine that saves appropriate files BEFORE TERMINATING THE PROCESS" . This means we are still in user mode. So answer is A.
0 votes
0 votes

In UNIX and UNIX-based systems, CTRL+C sends a SIGINT (Signal Interrupt) signal to the process. Its up to the receiving process how he wants to handle the signal. Most processes handle this signal by terminating gracefully, after performing cleaning up tasks before terminating.

But a process may or may not terminate upon receiving the signal. It is up to that process how he wants to handle it. Nothing is being forced on the process. It may also ignore this signal if it wants to. Programmers can customize how their processes handle the SIGINT signal by setting up signal handlers. These handlers are specialized functions that are invoked when the process receives a specific signal, such as SIGINT. By defining a custom SIGINT handler, programmers can control how their processes react to user interrupts.

For this reason, UNIX systems don’t require the sender of this signal to have special privileges. So A) is the correct answer.

For most signals like SIGTERM, SIGQUIT, etc, no special privileges are required. However, for more forceful signals like SIGKILL, special privileges will be required.

Answer:

Related questions

13 votes
13 votes
3 answers
1
Kathleen asked Sep 22, 2014
12,427 views
A common property of logic programming languages and functional languages is:both are procedural languages both are based on $\lambda$-calculusboth are declarativeboth us...
5 votes
5 votes
3 answers
3