456 views

2 Answers

1 votes
1 votes
Answer is - a) a software interrupt
1 votes
1 votes

The answer is A.

Let's see why. I'll explain with some background information.

 

There's two types of code — the user defined code (programming, basically) and OS code. To ensure proper functioning, these two codes should always be executed separately, and never together. For that, we need to distinguish between the user-defined code and the OS code.

To do so, a bit called mode bit is used in the hardware, that tells you the current mode of the machine. 0 => kernel mode and 1=> user mode. Hence, this mode bit helps us distinguish whether the user code, or the OS code is running.

A flag is a single bit variable that indicates something. Example: carry flag, overflow flag, zero flag etc. Mode bit can also be called as mode flag.

 

Now, when a user process needs some OS service(s), it asks the OS via a system call. It is clear that "system call" is nothing but the process calling the system for assistance.

When a system call is made, the mode bit changes to 0, and the machine enters the kernel mode (because system services are OS code, and to execute it we need to be in kernel mode).

 

A system call is just one of the ways to enter the kernel mode. The other two ways are — interrupts and traps.

 

Kernel mode can run both privileged and non-privileged instructions, while the user mode can run only non-privileged instructions.

Since, while making a system call, we're in the user mode, we can't make any privileged instruction. So Option D is incorrect. Options B and C are just fillers.

 

Is Option A correct? Yes. Why?

As said above, kernel mode is entered only via

  • system calls
  • interrupts
  • traps

These three words have somewhat overlapping definitions sometimes. A trap is usually a software interrupt, and an interrupt is an umbrella term for both Hardware and Software interrups.

Anyway, a system call is a process calling the OS => software calling the OS. Could be a trap, could be a software interrupt, Trap isn't in the options and the word "usually" is said in the question, so Option A is the option to go with.



 

More info

  • When going from user mode to kernel mode; the instruction is non-privileged because generating privileged instruction in user mode isn't possible.
  • When going from kernel mode to user mode; the instruction to switch to the user mode is privileged.
Answer:

Related questions

2 votes
2 votes
1 answer
1
Bikram asked Sep 3, 2016
293 views
Match these OS abstractions with Hardware components:A. Thread1. interruptB. Virtual address space2. memoryC. File system3. CPUD. Signal4. DiskA-2 B-4 C-3 D-1A-1 B-2 C-3 ...
3 votes
3 votes
1 answer
2
Bikram asked Sep 3, 2016
355 views
Semaphores are used to solve the problem ofresource allocationprocess synchronizationdeadlockprocess communication
3 votes
3 votes
1 answer
3
2 votes
2 votes
2 answers
4