Basics of Computer Operating System (1)---Overview of Operating System

introduction

The importance of basic computer knowledge is self-evident. Today's technology can be said to be updated at the rate of a second, but the basics will not change every few decades. This article is the first one, operating system overview, familiarize yourself with what is in the entire computer operating system, and it is also a knowledge point that will be learned in-depth in the following series of articles

1. Three stages of computer operating system development

1. No operating system stage

At this stage, the computer is operated manually, and when operating, each user will monopolize the computer, and the computer's CPU is waiting for manual operation. When the user inputs and outputs, the memory and CPU All are free. Therefore, in the era of no operating system, computing machine resource utilization is low

2. Batch processing system stage

At this stage, the computer no longer needs to wait for manual input. Because at this time, users will import tasks in batches, so that users can leave after importing tasks and the computer can automatically go to work. Therefore, at this stage, the utilization rate of the computer is greatly improved. At the same time, a very important design is proposed at this stage, called multiprogramming . This design later affected all our operating systems

3. Time-sharing system stage

At this stage, the most important design is the design of human-computer interaction , because in the first two stages, there is no way for humans to intervene during the execution of the program. In the time-sharing system stage, the human-computer can interact. . Moreover, people can debug programs in real time. This time-sharing system allows multiple users to share the resources of the computer. Therefore, at this stage, the utilization rate of computing resources is greatly improved. The time-sharing system is also the mainstream system now

The concept of multiprogramming: Early batch processing systems can only process one task at a time. Although in this batch processing system, we can input tasks in batches, but at this time the computer can only run one task at the same time. In other words, although the tasks are input in batches, the computer can only execute one task at a time. Because of the multi-program design, the batch processing system can handle multiple tasks at once

Multi-programming refers to storing multiple programs in the computer memory at the same time, and these multiple programs do not interfere with each other. The multiple programs here are interleaved and run under the computer's management program to improve the utilization of computer resources

Therefore, the management of multiple programs is an important function of the operating system. The computer operating system's management of multiple programs and resource management can be divided into five major functions:

  • Process management
  • Storage management
  • Job management
  • File management
  • Equipment management

The following will really introduce these five:

Process management

  • Process entity of process management
  • Five-state model of process management
  • Process synchronization of process management
  • Linux process management

Job management

  • Process scheduling of job management
  • Deadlock in job management

Storage management

  • Memory allocation and recovery of storage management
  • Segment page storage management
  • Virtual memory for storage management
  • Linux storage management

File management

  • Operating system file management
  • Linux file system
  • Basic operation of Linux files

Equipment management

  • Operating system device management

2. Operating system overview

1. What is an operating system? Why use an operating system

(1) What is an operating system

  • Computer operating system is to manage hardware and software resources of a computer program . In other words, the operating system is actually a computer program , function is to manage computer hardware and software resources.
  • Manage and configure memory, determine the order of resource supply and demand, and control input and output devices.
  • The operating system provides to let users interact with the system's user interface
  • There are many types of operating systems, not limited to computers
  • From mobile phones to supercomputers, operating systems can be simple or complex
  • On different devices, the operating system can present a variety of operation methods to the user (for example, on a mobile phone, we can control the hardware devices in the mobile phone (such as a camera, sound) through the touch of a finger), and on our ordinary PC side, we (Mainly through the mouse and keyboard to control the hardware)

Computer operating systems that we usually have access to:

a. For example, mobile phones are divided into Android and IOS. In fact, what we call Android belongs to the Android operating system , and IOS refers to the IOS operating system . In Android, we often know that Xiaomi’s MIUI, OPPO/VIVO’s colorOS, Meizu’s Flyme, etc., these are not strictly speaking of the operating system, these are based on the transformation of the Android operating system (may be the UI , Optimized, etc., the essence is still Android operating system)

b. Another example is the computers we often talk about, Windows, Linux, MacOS, etc. These are common computer operating systems in our lives. Linux systems include Centos and Ubuntu, which are all Linux operating systems in essence.

The following is the ultimate definition of a computer operating system: it is a software system that manages hardware and provides user interaction

(2) Why use an operating system

  • We cannot directly operate the computer hardware. For example, I need my computer to count 1 + 1, it is impossible to say just tell me that we have to count CPU 1 + 1, and we need the help of the operating system , allowing the operating system to hardware tell us what to do
  • With the development of computers up to the present, there are a wide variety of equipment and a unified interface is required. The operating system provides a unified operation interface, shielding the differences between different devices . With an operating system, we don’t need to pay attention to different devices, nor do we need to pay attention to different interfaces
  • The simplicity of the operating system allows more people to use the computer. More people can use the computer means the liberation and development of productivity, which is of great help to the improvement of human technology

2. The basic functions of the operating system

Let’s review some of the important resources in the computer we are concerned about:

(1) Processor resources (that is, CPU resources)

(2) Memory resources (memory, hard disk)

(3) IO device resources (printer, keyboard, display)

(4) File resources

The operating system will uniformly manage computer resources

For example, if we want to manipulate a file, we do not directly manipulate the storage location of the file. We use the operating system to manipulate the file. For example, when we store or read a file, we do not directly control the storage. Read and write information through the operating system

With an operating system, what is the difference when we use these computer resources?

Users do not need to program for hardware interfaces . In other words, we don't need hardware such as memory and IO devices, but only need to program for the operating system. For example, there is IO device management software in the operating system. This software provides a read and write interface. When programming, users can directly call this interface without having to contact a specific IO device.

The operating system implements the abstraction of computer resources . This abstraction is achieved through management software, which shields hardware devices and provides users with logical devices so that each user is the same when using it. This is the abstraction of computer resources

The operating system provides the interface between the user and the computer . Such as: graphical window form (by mouse clicks in windows), command form (in Linux by entering commands in the shell terminal), system call form (mainly during programming, such as opening files and reading data, etc.) All are done through system calls) If you draw a level for the hardware, operating system, and users, the interface is equivalent to the level in the red part below:

3. Operating system related concepts

There are mainly four related concepts that need to be focused on understanding:

  • Concurrency
  • Sharing
  • Virtuality
  • Asynchrony

(1) Concurrency

Concurrency is the prerequisite for the latter three characteristics, and only after understanding concurrency can you understand the latter three characteristics. To understand concurrency , we have to combine the concept of parallel to understand

  • Parallel refers to two or more events may be in the same moment occurred
  • Refers to two or more concurrent events may be at the same intervals at time occurs

So how are parallelism and concurrency reflected in the computer?

Let us think of the concept of multi-program design mentioned earlier, which is the basis of concurrency and parallelism

(a) For a single processor , the program is mainly executed concurrently. Suppose the blue is program A and the yellow is program B. At a certain time , only one program can occupy the CPU , then these two programs It runs alternately (multiple programs run alternately), so it is executed concurrently in a single processor

(b) For dual processors , the programs on each processor are running alternately , but for two processors, at a certain moment, there are two programs running at the same time

This is the embodiment of parallel concurrency in the computer

(2) Sharing

  • Sharing the performance of the operating system resources available for common use of multiple concurrent programs
  • This form is called the common use of resource sharing

for example:

Suppose a system memory, assuming that the red part of the program A is used, the green program B is used, although A and B using a different part of the main memory, then we can still say that this piece of main memory is shared the , Program A and Program B can use this main memory

Resource sharing can be divided into two ways according to attributes:

  • Mutually Exclusive Sharing Form
  • Simultaneous access form

Mutually exclusive sharing:

When the resource is occupied by program A, other processes can only use the resource if they want to use it. Only after process A is used up can other processes use the resource. For example, if the printer is used by a certain program A, other programs that want to print can only use the printer after the program A is printed.

At the same time visit:

A certain resource is concurrently accessed by multiple programs within a period of time . This "simultaneous" is macroscopic . From a macro perspective, the resource can be accessed simultaneously. For example, when we are using a hard disk, suppose there are program A and program B. I want to write data to the disk, because there is only one cantilever, so when Program A is writing in, Program B cannot be written in, but because writing data is faster, if we observe it in a period of time , We can think that it can be accessed at the same time. If we emphasize that it is used concurrently within a period of time , then it is actually a form of shared simultaneous access

(3) Virtuality

Virtuality manifests as the transformation of a physical entity into several logical entities . The physical entity is real (maybe a certain device in the computer), and the logical entity is virtual. Virtual technology mainly time division multiplexing technology and space division multiplexing technology

a, time division multiplexing technology

It refers to the multiplexing of resources in time, without the concurrent use of programs, and the time-sharing of multiple programs to use the hardware resources of the computer (for example, multiple programs alternately use CPU resources)

There are virtual processor technology and virtual device technology in time division multiplexing technology

Virtual processor technology

  • Multi-program technology
  • Establish a process for each procedure
  • Time-sharing multiplex processor for multiple programs

Virtual Device Technology

  • The physical device is virtualized as multiple logical devices
  • Each program occupies a logical device
  • Multiple programs access concurrently through logical devices

b. Space division multiplexing technology

Used to implement virtual disks and virtual memory to improve resource utilization and programming efficiency

Virtual disk technology :

Virtualize the physical disk as multiple logical disks (for example, our hard disk can be virtualized as C disk, D disk, E disk), which is safer and more convenient to use (for example, when we destroy some files on the C disk, it will not affect others Disk)

Virtual memory technology :

Logically expand the storage capacity of the program, so that the program can use a larger capacity than the actual memory, which greatly improves the efficiency of programming (when the process is running, first part of it is loaded into the memory, and the other part is temporarily stored on the disk. When the instructions to be executed or the data to be accessed are not in the memory, the operating system automatically completes the work of transferring them from the disk to the memory)

(4) Asynchrony

Asynchrony is manifested in the multi-program environment , allowing concurrent execution of multiple programs, and the process may need to wait or give up when using resources. The execution of the process is not done in one go, but is advanced in a stop-and-go situation ( Suppose that a certain process needs to use a certain resource when it runs to a certain moment. If this resource is occupied, the process may stop or wait for the resource to be released )

The red line above is a timeline of time advancement. There are three programs A, B, and C running alternately. Assuming that at a certain moment, A releases the printer's resources, and at the same time, B and C need to use the printer's resources , Then B and C will compete. Assuming that C successfully seizes the printer's resources, then in the remaining timeline, C is mainly running. Another possibility is that B has seized the printer's resources. At this time, B It will run for a while, and then it will run in C. So here, because we don’t know whether B seized the printer or C seized it.

Therefore, the process is advancing at an unpredictable speed. It is not known when the program is executed, when it is suspended, and when it is completed. So many unpredictable things lead to the asynchronous nature of the program.

It is the core competitiveness of a technical person to find the constant in the rapidly changing technology. Unity of knowledge and action, combining theory with practice

Standing on the shoulders of giants and learning, paying tribute to the predecessors

Reference: https://coding.imooc.com/class/355.html

Guess you like

Origin blog.csdn.net/self_realian/article/details/106949049