1,992 views
0 votes
0 votes
When we switch from user mode to kernel mode , via an interrupt it is done , Now is this a privileged instruction or a non-priviledged instruction which changes the mode bit .

 

Also we say that while switching from kernel mode to user mode , we don't require any privileged instruction , a non-priviledged instruction can change the mod bit but then for a non-priviledged instruction to be under execution , mode bit should be set for user mode , but currently we have kernel mode so how is it possible that an unprivileged instruction execute in kernel mode and change the mode bit .

 

Also is it the kernel which triggers this unprivileged instruction to change its bit .

2 Answers

0 votes
0 votes

Mode changing is done via different operation

We know Kernel Mode is Privilege Mode and  User Mode is Non Privilege Mode

Now, for changing mode i.e.

from Kernel to User Mode- Non Privilege Instruction is required

from User to Kernel Mode- A Software Interrupt is required

But context switch only happen in Kernel or Privilege Mode

 

0 votes
0 votes
Changing from user mode to kernel mode is done by CPU when it fetches privileged instructions(usually system calls) from programs running in user mode. When a user mode process makes a system call, then a TRAP is generated and CPU changes mode bit from 0 to 1.

Related questions

0 votes
0 votes
1 answer
2
LavTheRawkstar asked Apr 14, 2017
345 views
which protocol is responsible for synchronization in bluetooth?
1 votes
1 votes
1 answer
4
Umang Raman asked Oct 15, 2015
1,697 views
Which one of the following is allowed only in kernel mode?A) Read the time of day clockB) Save the status of processC) change the PC content.D) non of these