<>1. operating mechanism
<>1.1 Two instructions
* Privileged instruction
* Such as memory clear instruction
* Instructions that can only be used in kernel mode
* User programs are not allowed to use
* Non privileged instruction
* Such as ordinary operation instruction
* It can work in both target state and tube state
The operating system can execute all machine instructions , Applications can only use non privileged instructions .
<>1.2 Two processor states
* User mode （ Eye state ）
* here CPU Only non privileged instructions can be executed
* Nuclear mentality （ Tube state ）
* Privileged instruction , Non privileged instructions can be executed
Program status word register for two processor states （PSW） To identify the current state of the processor .
<> Program status word （PSW）
effect ： Realize the protection and recovery of program state .
Mark Division ： Status flag , Control sign and system sign .
<>1.3 Two procedures
* Kernel program
* He is the manager of the system
* You can execute privileged instructions , Nonprivileged instructions can also be executed
* Running in a nuclear mindset
* application program
* Only non privileged instructions can be executed
* Running in user mode
<>2. Kernel of operating system
kernel ： The underlying software configured on the computer , yes OS minimum , The core part .
The program that realizes the kernel function of the operating system is the kernel program .
* Interrupt handling
* Clock management
* Short range dispatching
* Primitive management
* The kernel is interrupt driven
* The kernel is not preemptive
* The kernel can be executed in the masked interrupt state
* The kernel can use privileged instructions
The kernel is OS The first transformation of bare metal , The kernel and bare metal made up the first virtual machine , Process running on virtual machine .
Virtual machine features :
* The virtual machine is not interrupted
* The virtual machine provides a virtual processor for each process
* Virtual machine provides powerful instruction system for process
<>3. The architecture of operating system
* Big kernel
* take OS The main function modules of the system are used as the system kernel , Running in a nuclear mindset
* advantage ： High performance
* shortcoming ： The kernel code is huge , Structural confusion , Difficult to maintain
* Only keep the most basic functions in the kernel
* advantage ： Few kernel functions , Clear structure , Easy maintenance
* shortcoming ： You need to switch between kernel state and user state frequently , Low performance
Huawei Hongmeng system uses micro kernel .