Operating environment of the operating system

1. Operating mechanism of the operating system


Most operating system kernels include 4 aspects

1、时钟管理
2、中断机制The original intention of introducing interrupt technology is to improve the utilization of CPU in multi-program running environmentFor example, keyboard or mouse information input, process management and scheduling, system function call, device driver, file access, etc.
3、原语 Atomic定义原语的直接方法是关闭中断,让其他动作不可分割地完成后再打开中断
4、系统控制的数据结构及处理There are three common operations:Process management, memory management, equipment management


2. The concept of interrupts and exceptions

After the operating system introduces the user mode (目态)and the core mode (管态), the switching of these two states must be considered.
Operating system kernel works in the core state
User program works in user mode

 发生  中断或异常时,运行用户态的CPU会立即进入核心态

Insert picture description here
Insert picture description here

3. System call

所谓系统调用,是指用户在程序中调用操作系统所提供的一些子功能,系统调用可视为特殊的公共子序列

Generally, there are dozens to hundreds of system call commands provided by an operating system. These systems can be roughly divided into the following categories according to the calling function.
Insert picture description here
Obviously, the system-related function and calls the operation and the like, the impact on the whole system is very large,系统资源管理 进程管理Therefore, certain privileged instructions are required to complete 系统调用的处理需要由操作系统内核程序负责完成,要运行在 Core state. 用户程序可以执行陷入指令(又称访管指令或trap指令)来发起系统调用。
Insert picture description here

4. Big core and micro core

Big kernel: The main functional modules of the operating system are run in the core state as a closely connected overall system
Microkernel: Keep the most basic functions in the kernel (such as process management, etc.) in the kernel, and move the functions that do not need to be executed in the core state to the user state execution需要频繁切换用户态和核心态,可能影响了效率,更加稳定(The fewer kernel services, the more stable)

例题


Insert picture description here
Insert picture description here


Insert picture description here
Insert picture description here


Insert picture description here
Insert picture description hereInsert picture description here


Insert picture description here
Insert picture description here


Insert picture description here
Insert picture description hereInsert picture description here


Guess you like

Origin blog.csdn.net/weixin_38220799/article/details/109037994