Condensed summary review of knowledge points at the end of the operating system

Chapter 1 Computer System Overview

1. The concept of operating system

  • Operating System (Operating System, referred to as OS) refers to a collection of programs that control and manage the hardware and software resources of the entire computer system, rationally organize and schedule computer work and resource allocation, and provide users and other software with a convenient interface and environment. .

2. Operating system characteristics

  • The operating system is the computer systemThe most basic system software, The basic features of the operating system includeConcurrency, sharing, virtual and asynchronous

(1) Concurrence

  • Concurrency refers to the occurrence of two or more events in the same time interval (note the distinction from parallelism).
  • Therefore, the operating system has the ability to process and schedule multiple programs simultaneously
  • The purpose of introducing processes is to enable programs to be executed concurrently.

(2) Sharing (Sharing)

  • Sharing means that resources in the system are used by multiple concurrently executing processes in memory . Sharing can be divided into mutually exclusive sharing mode and simultaneous access mode.
  • Mutually exclusive sharing method :Specify that only one process can access the resource within a period of time(For example: printers, tape drives), such resources are called critical resources, exclusive resources or shared resources. Example: The camera can only be assigned to QQ or WeChat, and you cannot have video chats in QQ and WeChat at the same time.
  • Simultaneous access method :This type of resource allows for "simultaneous access" by multiple processes over a period of time(For example: disk), the "simultaneous" mentioned here is usually on the macro level, while on the micro level, these processes alternately access the resource. Example: QQ sends file A and WeChat sends file B. At this time, the hard disk is accessed at the same time.
The relationship between concurrency and sharing:
  • Concurrency and sharing are the two most basic characteristics of operating systems. The two are interdependent. Without sharing, there is no concurrency, and without concurrency, there is no sharing.

(3) Virtual

  • Virtuality refers to turning a physical entity into several logical counterparts

(4) Asynchronism (Asynchronism)

  • The operating system allows multiple concurrent processes to share resources, so that the running process of each process is restricted by other processes, so that the execution of the process is not done in one go, but runs in a stop-and-go manner, which advances at an unpredictable speed. This is the asynchronous nature of the process.

3. The role of the operating system

(1) Operating system as the manager of computer system resources

  • Processor management : Mainly control and manage the work of the CPU.
  • Memory management : Mainly allocate and manage memory.
  • File management : Mainly manage basic input and output devices.
  • Equipment management : responsible for the organization, storage, operation and protection of computer files.
  • example:
operating Management type
Find the location of QQ in each folder File management
Double click to open QQ QQ is put into memory Memory management
QQ operation Processor management
Video chat Equipment management

(2) The operating system serves as the interface between the user and the computer hardware system

  • Command interface : There are two main ways of using command interface for job control, namely online control mode and offline control mode. According to different job control methods, the command interface can be divided into online command interface and offline command interface.
  • Online command interface : also known as interactive command interface, suitable for time-sharing or real-time system interface. It consists of a set of keyboard operation commands.The online command interface can be understood like this: "employer" says a word, "worker" does one thing and gives feedback, which emphasizes interactivity
  • Offline command interface : also known as batch processing command interface, which is suitable for batch processing system interface. It consists of a set of job control commands (statements).The offline command interface can be understood like this: "employer" writes "worker" on the list, and "worker" completes these things one by one according to the list commands. This is batch processing.
  • Program interface : consists of a set of system call commands (referred to as system calls, also known as generalized instructions). The most popular is GUI, that is, graphical interface.

(3) The operating system is used as an expansion machine

  • A computer without any software support is called a bare metal .
  • The outer layer of the bare metal is the operating system. We can compare the bare metal to a "machine" and the operating system as a "worker". If there is no "worker", the "machine" is just a pile of iron, which cannot perform its real function. "Workers" operate the "machines" and if they control and coordinate the machines reasonably, they can perform their real functions.

4. The development and classification of operating systems

(1) Manual operation stage (no operating system at this stage)

  • The user monopolizes the whole machine, and there will be no waiting phenomenon because resources have been occupied by other users, but the resource utilization rate is low.
  • The CPU is waiting for manual operation, and the CPU is not fully utilized.
  • Solution: Use high-speed machines instead of relatively slow manual operations to control the job.

(2) Batch processing stage (the operating system begins to appear)

  • Single batch processing system :
characteristic In order to solve the contradiction between man and machine and the speed mismatch of CPU and I/O equipment
Automaticity Jobs on the tape can be automatically carried out one by one without manual intervention
Sequentiality Each job on the tape enters the memory sequentially
Unipathy Only one program is stored in the host memory each time
  • Multi-pass batch processing system :
characteristic Further improve resource utilization and system throughput
Multiple Simultaneously store multiple independent programs in computer memory
Macroscopically parallel Simultaneous operation of multiple programs that enter the system at the same time
Micro serial Multiple programs in memory take turns to preempt the CPU and execute alternately
  • The interactive capability of drones in the batch processing stage at this time improves resource utilization and system throughput.

(3) Time-sharing operating system

  • Time-sharing technology is to divide the running time of the processor into short time slices.Assign processors to each online job in turn according to time slice

(4) Real-time operating system

  • In order to complete certain urgent tasks within a certain time limitNo time slice queuing required

5. Operating environment of the operating system

(1) Operating mechanism of the operating system

  • Usually the CPU executes two different types of programs: one is the operating system kernel program; the other is a user-programmed program (application program). User self-programming runs onUser mode, The operating system kernel program and privileged instructions run onCore state
Example of shifting from user mode to core mode
The user program requires the service of the operating system that is the system call
Interrupted
An error state occurred in the user program
Attempt to execute a privileged instruction in the user program
The transition from core mode to user mode is realized by a privileged instruction (interrupt return instruction)

(2) Operating system architecture

  • Big kernel : The big kernel system runs the main functional modules of the operating system as a closely connected whole in the core state, so as to provide high-performance system services for applications.
  • Microkernel : The microkernel structure effectively separates the kernel and services, services and services, making the interface between them clearer, and the maintenance cost is greatly reduced. Each part can be optimized and evolved independently, thus ensuring the reliability of the operating system .

6. Difficulties in this chapter

(1) The difference and connection between parallelism and concurrency

  • Parallelism means that two or more eventsAt the same momentoccur.

  • Concurrency means that two or more eventsSame time intervalHappen within.

  • In a multi-program environment, concurrency refers to a period of time, macroscopically, multiple programs are running at the same time, but in a single processor (CPU) system, only one program can be executed at a time, so these programs are microscopically It can only be executed alternately in time-sharing. If there are multiple processors in the computer system, these programs that can be executed concurrently are distributed to multiple processors to achieve parallel execution, that is, each processor is used to process a program that can be executed concurrently.

(2) Privileged instructions and non-privileged instructions

  • The so-called privileged instructions refer to instructions with privileged authority. Since this type of instruction has the most authority, if used improperly, it will cause the entire system to crash . For example: clearing memory, setting clocks, allocating
    system resources, modifying virtual memory segment tables and page tables, and modifying user access rights. If all programs can use these instructions, it is not surprising that your system crashes n times a day
    . In order to ensure the safety of the system, such instructions can only be used in the operating system or other system software, and are not directly provided to users. Therefore, privileged execution must be executed in the core state . In fact
    , the cpu can execute the complete set of the instruction system in the core mode. Visually speaking, privileged instructions are things that are not suitable for children, while non-privileged instructions are suitable for all ages.
  • In order to prevent the use of privileged instructions in the user program, only non-privileged instructions can be used in user mode, and all instructions can be used in core mode . When the privileged instruction is used in the user mode, an
    interrupt will be generated to prevent the user from using the privileged instruction. Therefore, the user program is run in the user mode, and the part of the program that must use privileged instructions in the operating system runs in the core mode, which ensures
    the safety and reliability of the computer system.The only way to switch from user mode to core mode is interruption or exception

Guess you like

Origin blog.csdn.net/qq_43663263/article/details/106107240