Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In microprocessor, there are a number of modes like user mode,supervisor mode and so on depending on the architecture of the computer. Why they have created so many modes(why they have assigned so many privileges)

share|improve this question

migrated from electronics.stackexchange.com Aug 21 '13 at 12:22

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

    
Are you sure that the modes you're asking about are microprocessor's modes, and not operating system modes? –  Vasiliy Zukanov Aug 20 '13 at 20:56
add comment

1 Answer 1

It is often useful for an operating system to be able to run code from a potentially-untrusted source without having to give the code unlimited power to damage the system. If a processor didn't have any concept of "user mode" and "supervisor mode", the only way an operating system could limit the actions of the untrusted code would be to inspect every single instruction to ensure that it wasn't doing anything that might cause damage. Not exactly speedy. To improve the situation, processors that are designed to facilitate the use of potentially-untrusted code can invoke a "restricted" mode. In this mode, most of the instructions work as they normally would, but are only allowed to access particular areas of memory. To switch back to "unrestricted" mode, it's necessary to execute an instruction which will simultaneously switch the processor to unrestricted mode and transfer program execution to one of a number of special addresses that would be unavailable in restricted mode. Each address is associated with some kind or request for the operating system to do something (typically the exact operation will be specified by the combinations of values in different registers); the operating system code will examine each request and make sure it represents something the calling code is allowed to do; if it does, the operating system will perform the indicated operation and then execute an instruction which will simultaneously put the machine back into restricted mode and transfer program execution to the instruction after the last "request operating-system action" instruction.

Because switching modes is somewhat expensive, some processors have included facilities to allow some programs' actions to be tightly restricted while others are allowed to do a few more things. In practice, however, it's often simpler to just have two modes: restricted and unrestricted (often called "user" and "supervisor").

share|improve this answer
    
I saw the names "user mode" and "supervisor mode" in ARM2 first (late 1980's), don't know how that evolved over the years. x86 uses a model of rings IIRC not all rings are actively used, but virtualisation makes use of them too. –  jippie Aug 21 '13 at 5:20
    
First thanks for reply..........Yes I have also studying the ARM in order to learn the assembly language. I am still not clear about the following question-: 1. Who take the first decision of the modes(means when we open the computer then in which mode microprocessor works) 2. Is that memory area which is restricted is only of RAM or it also include ROM. –  Jatin Khurana Aug 23 '13 at 17:01
    
@JatinKhurana: Processors generally start up in supervisor mode, since only supervisor mode is capable of configuring what features should be available to what pieces of "user mode" code. As for what memory is available, many processors allow supervisor-mode code to configure the relationship between logical addresses and physical devices which may include ROM, RAM, I/O, or anything that could be wired to an external bus. –  supercat Aug 23 '13 at 20:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.