Kernel Mode vs user mode

Source: Internet
Author: User

Dolphin browser 2013.5. 10 intern First Choice

Which of the following statements about the OS kernel mode is true:

In kernel mode, all processes share the same address space.

The system call will definitely switch to the kernel mode for execution.

Unhandled exceptions in kernel mode can cause system crash

The driver is mainly executed in kernel mode.

In a 32-bit x86 system, the space of each process is 4 GB, that is, the address 0x00000000 to 0 xffffffff.
For efficient calling, Windows will map the kernel data of the operating system to the process space of all processes in the system mapped to the code. Therefore, the 4 GB space is divided into two areas: user space and system space. The default size is 2 GB each.

To protect the system code and data mapped to the process space, Windows provides a permission control mechanism. There are two access modes: user mode and kernel mode.
At the hardware level, the processor ensures that data and code with a higher priority will not be damaged by a lower priority.
For x86 processors, there is no register to indicate the mode in which the processor is currently in, and an attribute of the memory segment or page of the priority knowledge code or data.

Two modes of mode switching: Soft Interrupt and quick System Call Command

User Mode:

Any process started in Windows runs in user mode. In this mode, the process cannot access resources of other processes unless it is called through APIS. In this mode, the program running cannot process interrupts and context switching ).

 

Interrupts ):

The CPU is often interrupted by some events (Interrupt), such as timers, keyboards, and hard disks. These events are called interrupts ). The operating system kernel must create some interrupt processors (interrupts handlers) to handle these events. As a result, the operating system stops the program being executed and transfers it to kernel mode to interrupt the processor to handle these events. The event processor saves the current CPU status, processes the event, and restores the CPU status, so that the CPU can continue the previous program.

When a program wants to call a Windows API, it will trigger an interrupt (Interrupt), so that the CPU enters the kernel mode to execute the required API. After the API is called, the CPU switches back to the user mode and continues executing the previous program.

 

Context switching)

Environment switching is performed by the operating system. The steps for Environment switching are as follows:

(1) Save the running status of the current program

(2) indicate the next program to be run

(3) restore the status of another process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.