Operating system overview
Article Directory
1. The concept and function of the operating system
1. The concept of operating system
(1) The manager of system resources
(2) Provide easy-to-use services to the upper layer
(3) The software closest to the hardware
2. Functions of the operating system
(1) The manager of system resources:
Before executing a program, the program needs to be placed in memory before it can be processed by the CPU
(2) Provide simple and easy-to-use services to the upper layer:
packaging ideas: the operating system encapsulates the hardware into easy-to-use services, so that users do not need to care about the underlying hardware principles, and only need to issue instructions to the operating system to use the computer
Program interface: The program interface can be used for system calls in the program. Ordinary users cannot directly use the program interface,
but can only use the program code indirectly, such as:
(3) The software closest to the hardware: the
operating system extends the hardware machine : Organize the CPU, memory, hard disk and other hardware reasonably so that various hardware can cooperate with each other to achieve more complex functions
- Knowledge review:
Second, the characteristics of the operating system
1. The operating system has four characteristics
2. Concurrency
Refers to multiple events occurring in the same time interval. These events occur simultaneously at the macro level and alternately occur at the micro level.
Note:
(1) Different from parallel, parallel refers to multiple events occurring at the same time
( 2) Single-core CPU can only execute one program at the same time, and each program can only be executed concurrently.
(3) Multi-core CPU can execute multiple programs at the same time, and multiple programs can be executed in parallel
3. Sharing
Means that the resources in the system can be used by multiple concurrently executing processes in memory.
Two resource sharing methods:
Example:
Mutually exclusive sharing method: the camera can only be assigned to one of WeChat or QQ process in the
same time period. Simultaneous sharing method: WeChat and QQ send files to friends, and the two processes access hard disk resources at the same time (alternatively microscopically)
4. Virtual
Refers to turning a physical entity into several logical counterparts.
Virtual memory technology: users only have 4G running memory, but they can run multiple software with a total memory greater than 4G.
Virtual processor technology: single-core CPU can run multiple at the same time Procedure (alternate microscopically)
5. Asynchronous
Refers to the implementation of the process is not consistent to the end, but stop and go, and move forward at an unknown speed
- Knowledge review:
note:
- Concurrency and sharing mutually exist conditions
- Concurrency and sharing are the two most basic features of an operating system. Without these two, there is no virtual and asynchronous
3. The development and classification of operating systems
1. Knowledge overview
2. Manual operation stage
Main disadvantages: Contradiction between man-machine speed and extremely low resource utilization
3. Single-channel batch processing system
Introduce offline input/output technology (complete with peripheral machine + tape), and the supervisory program is responsible for the input and output of the job
Main advantages: alleviate a certain degree of human-machine speed contradiction, and improve resource utilization.
Main disadvantages: there can only be one program running in the memory, and the next program can only run after the end of the program. The CPU has a lot of time While waiting for I/O to complete, resource utilization is still low
4. Multi-pass batch processing system
The operating system was officially born to support the concurrent execution of multiple programs.
Main advantages: concurrent execution of multiple programs, sharing computer resources, and greatly improved resource utilization.
Main disadvantages: no human-computer interaction function (users cannot control program execution in the middle, (Can only wait for computer processing to complete)
5. Time-sharing operating system
The computer serves each user/job in turn in units of time slices, and the user can interact with the computer through the terminal.
Main advantages: solves the problem of human-computer interaction, allows multiple users to use the same computer, and each user is independent of each other.
Main disadvantages: Some urgent tasks cannot be processed first, and the operating system is completely fair to each user/job
6. Real-time operating system
Main advantage: It can respond to some urgent tasks first, and some urgent tasks do not need time slice queuing
7. Several other operating systems
Network operating system
Distributed operating system
Personal computer system
- Knowledge review:
4. Operating mechanism and architecture of the operating system
-
Instructions: Refers to the most basic commands that the processor (CPU) can recognize and execute
-
Two instructions:
-
Two processor states:
-
Two procedures:
-
Kernel: The
kernel is the underlying software on the computer and is the most basic and core part of the operating system.
The program that implements the kernel functions is the kernel program
-
Operating system kernel diagram:
-
Knowledge review:
Five, interruption and exception
-
The function of the interrupt: It will make the CPU change from the user mode to the core mode immediately, so that the operating system can regain control of the CPU
-
Interrupts are the only way for the operating system kernel to regain CPU usage rights
-
If there is no interrupt mechanism, once the application program runs on the CPU, the CPU will always run the program, there is no concurrency at all
-
Core mode → User mode: execute a privileged instruction, that is, modify the PSW flag to be user mode, which means that the operating system gives up the
right to use the CPU -
User mode → core mode: triggered by an interrupt. After the interrupt occurs, the currently running process is suspended, and the OS kernel handles the interrupt
-
Classification of interruptions:
-
Knowledge review: