Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User mode vs supervisor mode

I have a few questions on the user-mode and supervisor-mode on Unix-like machines.

What is the difference between user-mode and supervisor-mode? I know that the user processes cannot access all memory and hardware and execute all instructions. Is there more to this?

What are the advantages of having different modes?

What are the steps involved when one switches from the user-mode to the supervisor mode?

When a system call is made by a user-program, the mode has to change from user-mode to supervisor mode. I have read elsewhere that this is achieved on x86 machines by using an int x80. So how is a mode-switch different from interrupt handling?

How is it different from a context-switch?

How are supervisor modes implemented in different architectures?

Any answers or pointers will be appreciated!

like image 562
user58860 Avatar asked Sep 15 '25 09:09

user58860


1 Answers

Two concepts exist:

  • software user/kernel modes, which are switched from each other when performing a system call or a return form system call,
  • hardware user/supervisor modes, which are switched from each other on interrupts.

Very few code is executed in HW supervisor mode, mainly interrupt routines at low level and the very beginning of startup. Even most of SW kernel mode is executed in HW user mode.

like image 72
mouviciel Avatar answered Sep 17 '25 19:09

mouviciel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!