1.1.5 Operating system (interrupts and exceptions, system calls)

content

interrupt

1. The role of interruption

2. Classification of interruptions

 3. Processing of external interrupts

system call

1. What is a system call and what does it do?

2. The difference between system calls and library functions

3. System call process


interrupt

1. The role of interruption

1. When an interrupt occurs, the CPU immediately enters the core state

2. When an interrupt occurs, the currently running process is suspended and the interrupt is processed by the operating system kernel

3. For different interrupt signals, different processing will be performed

When an interruption occurs, it means that the operating system needs to step in and carry out management work. Since the management of the operating system (such as process switching, allocation of I/O devices, etc.) requires the use of privileged instructions, the CPU needs to be converted from user mode to core mode. Interrupts can make the CPU switch from user mode to kernel mode, allowing the operating system to gain control of the computer. With interrupts, concurrent execution of multiple programs can be achieved.

2. Classification of interrupts: external interrupts and internal interrupts

 3. Processing of external interrupts

system call

1. What is a system call and what does it do?

Knowledge point review:
As the interface between the user and the computer hardware, the operating system needs to provide some simple and easy-to-use services upward. Mainly includes command
interface and program interface. Among them, the program interface consists of a set of system calls .

"System call" is the interface provided by the operating system to the application program (programmer / programmer), which can be understood as an interface available for application

A special function called by a program, an application can request the services of the operating system kernel through system calls

Applications request the services of the operating system through system calls . The various shared resources in the system are under the unified control of the operating system kernel, so any
Operations related to shared resources (such as storage allocation, I/O operations, file management, etc.) must be provided to the operating system kernel through system calls.
The service request is completed by the operating system kernel on its behalf. In this way , the stability and security of the system can be guaranteed, and users can be prevented from performing illegal operations.

Expansion: Interested students can search for " Linux system calls" to understand what systems are provided by the Linux operating system

2. The difference between system calls and library functions

 

3. System call process

 

Pass the system call parameters →  execute the trapped instruction ( user mode ) →   execute the corresponding kernel request kernel program to process the system call ( kernel mode ) → return →   application program  
Notice:
1. The trapped instruction is executed in the user mode , and an internal interrupt is triggered immediately after the execution of the trapped instruction , so that the CPU enters the core mode
2. The system call request is issued in the user mode , and the corresponding processing of the system call is carried out in the core mode

 

Guess you like

Origin blog.csdn.net/Javascript_tsj/article/details/123471899