1.1 Basic concepts of operating system

1.1 Basic concepts of operating system

Knowledge Graph

mind Mapping

1. The concept of operating system

The computer system can be roughly divided into four parts from bottom to top: hardware, operating system, application and user .

Operating System (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. The operating system manages various computer hardware, provides the basis for application programs, and acts as an intermediary between computer hardware and users. It is gradually formed and developed with the development of computer research and application. It is the most basic system in computer systems Software .

Second, the characteristics of the operating system

The basic characteristics of the operating system include concurrency, sharing, virtualization and synchronization .

1. Concurrence

Concurrency means that two or more events occur within the same time interval. The concurrency of the operating system means that there are multiple running programs in the computer system at the same time, so it has the ability to process and schedule the simultaneous execution of multiple programs. In the operating system, the purpose of introducing processes is to enable programs to be executed concurrently.

Note the difference between Concurrence and Parallelism:

  • Concurrence : A processor processes multiple tasks at the same time, which refers to the logical simultaneous occurrence;
  • Parallelism : Multiple processors or multi-core processors process multiple different tasks at the same time, which refers to the physical simultaneous occurrence.

2. Sharing

Resource sharing is sharing, which means that the resources in the system can be used by multiple concurrently executing processes in the memory. Sharing can be divided into mutually exclusive sharing mode and simultaneous sharing mode.

Mutually Exclusive Sharing

Some resources in the system, such as printers, can be used by multiple concurrently executing processes. However, in order to avoid the chaotic use of resources in this process to print a little while the other prints a little, the operating system stipulates that only one is allowed within a period of time. The process accesses the resource . This way of sharing resources is mutually exclusive sharing . This kind of resources that only one process can access within a period of time is called critical resources or exclusive resources .

When process A accesses a critical resource, it must first make an access request to the operating system. If the resource is free at this time, the operating system allocates the resource to process A. After that, other processes must wait until the process wants to access the resource. A. After accessing and releasing the resource, other processes can access the resource.

Most of the physical devices in the computer system and the stacks, variables, and tables used in some software are critical resources, and they are all required to share mutually exclusive.

Simultaneous sharing

A certain resource in a computer can be accessed by multiple processes at the same time within a period of time. This resource access method is called simultaneous sharing.

Simultaneous sharing usually requires that a request be divided into several time segments to complete, that is, alternate, "time sharing". Therefore, the "simultaneous" here refers to the macroscopic level, and the microscopic level still alternates. It's just that the CPU execution speed is so fast that we can't feel the alternation.

For example, when we play a game and listen to a song, the game and the music player are two different processes, but they can occupy the audio playback device at the same time. Therefore, we can hear both music and game sounds.

The two most basic characteristics of concurrent and shared operating systems are conditions for each other's existence:

  • Resource sharing is conditional on the concurrency of programs. If the system does not allow programs to be executed concurrently, there will be no problem of resource sharing;
  • If the system cannot implement effective management of resource sharing, it will definitely affect the concurrent execution of the program.

3. Virtual

Virtual refers to the transformation of a physical entity into several logically corresponding objects. Physical entities are "real" and actually exist; while their counterparts are "virtual" and are logically constructed. The technology used to realize virtualization is called virtual technology .

The operating system uses a variety of virtual technologies to implement virtual processors, virtual memory, and virtual peripherals, including the Docker and K8S currently used, which are also implemented using virtual technologies.

Multi-program design technology is to store several independent programs in the computer memory at the same time , so that they can be interspersed and run under the control of the management program. Two or more programs are at the same time between the beginning and the end in the computer system. State, these programs share computer system resources. Corresponding to it is a single program, that is, only one program is allowed to run in the computer memory.

The following briefly introduces the following virtual technologies:

  • **Virtual processor technology: **It is designed through multiple programs, using a method that allows multiple programs to be executed concurrently, using one processor in time sharing. Although there is only one physical processor, it can be used by multiple users at the same time, so that each end user can feel that there is a CPU serving itself. Use multi-programming technology to virtualize a physical CPU into multiple logical virtual CPUs, called virtual processors;
  • Virtual storage technology : Virtual storage technology can change the physical storage of a machine into virtual storage, thereby logically expanding the capacity of physical storage. The memory that the user feels is called virtual memory. For example, an 8GB memory module is installed on the computer. Since virtual storage technology can derive multiple virtual memories, the operating system allows each process to run on the virtual memory, so every process feels that it has exclusive use of 8GB of memory. In fact, they use the 8GB of physical memory together;
  • Virtual device technology : virtualize a physical I/O device into multiple logical I/O devices, and allow each user to occupy one logical I/O device. The critical resource that was originally only allowed to be accessed by one user for a period of time has become a shared resource that allows multiple users to access for a period of time.

The virtual technology of the operating system can be summarized as: time division multiplexing technology , such as time sharing of processors; space division multiplexing technology , such as virtual memory technology.

4. Asynchronism (Asynchronism)

The multi-program environment allows multiple programs to be executed concurrently, but due to limited system resources, the execution of the process is stop-and-go, and it runs forward at an unpredictable speed. This is the asynchronous nature of the program.

Only if the operating system has concurrency will it have asynchrony.

Asynchrony makes the operating system run in a random environment, which may cause the process to produce time-related errors (for example, improper access to global variables will cause program errors). But as long as the operating environment is the same, the operating system must ensure the same results.

3. The objectives and functions of the operating system

In order to provide a good operating environment for multiple programs, the operating system should have the following functions: processor management, memory management, device management and file management ;

In order to facilitate the user to use the operating system, an interface must also be provided to the user .

1. The manager of computer system resources

(1) Processor management

In a multi-program environment, the allocation and operation of processors are based on processes (or threads) as the basic unit. Therefore, the management of the processor is actually the management of the process.

Process management mainly includes: process control, process synchronization, process communication, deadlock handling, and processor scheduling .

(2) Memory management

Memory management is to provide a good environment for the operation of multiple programs, facilitate users to use and improve memory utilization.

Memory management mainly includes: memory allocation, address mapping, memory protection and sharing, and memory expansion .

(3) Document management

The information in the computer exists in the form of files, and the part of the operating system responsible for file management is called the file system .

File management mainly includes: storage space management, directory management, and file read-write management and protection .

(4) Equipment management

The main task of device management is to complete the user's I/O request, facilitate the user to use various devices and improve the utilization of the device.

The main management apparatus comprising: a buffer management, device allocation, and the virtual device processing equipment .

2. Interface between user and computer hardware system

In order to facilitate users to use the computer, the operating system also provides a user interface.

The interfaces provided by the operating system are mainly divided into two categories: command interfaces , users use command interfaces to organize and control the execution of jobs; program interfaces , programmers use program interfaces to request operating system services.

(1) Command interface

There are two main ways of using the command interface for job control: online control and offline control . According to the control mode, the command interface can be divided into an online command interface and an offline command interface .

Online command interface

Online command interface is also called interactive command interface , which is suitable for time-sharing or real-time system interface.

The user inputs operation commands through the console or terminal.

Every time the user enters a command, the control right is transferred to the command interpreter of the operating system, and then the command interpreter interprets and executes the entered command. After the function is completed, the control right is transferred to the user.

Offline command interface

The offline command interface is also called the batch command interface , which is suitable for batch processing systems.

It consists of a set of job control commands. Offline users cannot directly intervene in the operation of the program, but should write a job operation manual with corresponding job control commands in advance, and submit it to the operating system together with the job. When the system schedules the job, the command interpreter in the system gradually interprets and executes the commands or job control statements in the job operation manual, thereby indirectly controlling the operation of the job.

Such as Save the following program for the .batextension of the text, the system is running under Windows can batch create folders. This xxx.batprocedure is a job operating instructions, which batch command code is:

md folder1 folder2 folder3

(2) Program interface

The program interface consists of a set of system call commands (referred to as system calls, also known as generalized interfaces).

The user requests the operating system to provide services for him by using these system call commands in the program, such as using external devices and performing disk operations.

The most popular graphical user interface (GUI, that is, graphical interface) is not part of the operating system, but the system call commands invoked by the graphical interface are part of the operating system.

3. Use as an extender

A computer without any software support is called a bare metal, which only constitutes the material basis of a computer system.

The resource management functions provided by the operating system and various user-friendly service functions transform the bare metal into a machine with stronger functions and more convenient use.

Therefore, we usually call a machine covered with software an expansion machine or a virtual machine .

Reference material: Wangdao postgraduate entrance examination-operating system

Guess you like

Origin blog.csdn.net/qq_43580193/article/details/112849582