The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+33 votes

A CPU has two modes -- privileged and non-privileged. In order to change the mode from privileged to non-privileged

  1. a hardware interrupt is needed
  2. a software interrupt is needed
  3. a privileged instruction (which does not generate an interrupt) is needed
  4. a non-privileged instruction (which does not generate an interrupt) is needed
asked in Operating System by Veteran (59.4k points)
edited by | 3.6k views

1 Answer

+34 votes
Best answer

Answer should be D. Changing from privileged to non-privileged doesn't require an interrupt unlike from non-privileged to privileged. Also, to loose a privilege we don't need a privileged instruction though a privileged instruction does no harm.

answered by Veteran (339k points)
selected by

In the text you quoted it says " by some instruction.It never says it is previledged.

The second reference i shared clearly says "The instruction to switch from supervisor to kernel is privileged".

you said 

In priviledged mode ( or supervisor mode in above text ) both priviledged and Non priviledged instruction can run.[ see the 2nd line ] so that means a non priviledged instructions can take from supervisor mode to user mode.

Both privileged and non privileged can execute does not mean the non privileged can take from supervisor to user mode.


.[ here in book last line says priviledged instructions only executed in kernel mode or supervisor mode , it does not say which instruction take you from kernel mode to user mode !! ]

It clearly says in the last line.In second reference i shared.Please check again



just go to 3rd slide here

and check the state diagram , it is directly given that a non priviledged instruction takes kernel to user mode.

Where as in ur 2nd reference it only says in kernel mode only priviledged instruction can execute. 


Sir second reference says 

The instructions that switch from supervisor mode to kernal are previledged

The above os the direct line which is what asked in question.

In your reference it says

• Switching to user mode (from kernel mode) done by setting CPU mode bit (by an instruction).

I checked the state diagram on first page,it is no where written that a non priveledged takes control to user mode.

Even i am not able to find the text "non priviledged instruction " in the reference you are giving.


rahul sharma 5 

See Kernel mode to user mode is done via an instruction so first 2 options we can safely remove as these hardware and software interrupts are not any instruction.

So we left with option C and D .

When you go from kernel mode to user mode , means you are going towards non priviledged mode , it is not necessary to be privileged to invoke the task . So non priviledged instruction can take from kernel to user mode. ( yes there is a slight chance that option C is correct but there is more chance/ possibility  for option D ) 

To be true what instruction is used is completely architecture-dependent. ( wheather it is priviledge or non priviledge )

Go through below discussion , read the comments against best answer

and that Galvin snap you posted, was a typo ..

see this


And here

it clearly mention that

 Operating systems hide privileged instructions and provide virtual

instructions to access and manipulate virtual resources, e.g., I/O to and

from disc files "

Virtual instructions are system calls .


At the end we can say

To change the mode from kernel mode to user mode ...only a bit(mode bit) is changed in register ( by setting mode bit to 1 ), nothing else is required .

So no privileged instructions or interrupts are required. This makes option D correct.


@ruhul sharma 5

The mode bit is just a CPU register. It's only accessible if you're already in kernel mode.

First, see how we set the mode bit when we go from User mode to Kernel mode.

The details of how it gets set, depend on the CPU design. In most common hardware, it gets set automatically when executing a special opcode that's used to perform system calls. 

See here, it is not the kernel who set mode bit for himself to go into the kernel mode. It was automatically set through hardware by CPU.

You can read about this at here also. (2nd answer).

Now come to the kernel to user mode.

What I think.

A privileged instruction can set the mode bit to go to User mode from Kernel mode. And start executing the user instruction. There is no harm as the kernel has the access to the mode bit.

But it is not necessary. 

When we start executing a non-privileged instruction. Before its execution, the CPU detects it (as we did for system call by using opcode) and set the mode bit automatically.

As we can change mode bit with non-privileged instruction. D is the correct answer. Because we are not required to have a privileged instruction for it.


To loose a privilege, you don't need privilege  - this line sums up the answer beautifully.

What does it mean in context to this question??
is this the same as privileged and non-privileged execution modes in Linux?
switching from user mode to kernel mode do we require mode bit or software interrupt or hardware explain plz.
@bikram sir
Why option C is wrong?? As instruction can be privileged or non privileged also .
As u said mode bit can be changed by Some instruction

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

34,942 questions
41,951 answers
41,471 users