Operating System Learning Notes (1) Characteristics and Development Classification of Operating Systems
Recently, I seriously looked at the operating system from the beginning. I felt that I didn’t do anything in college, and the whole process seemed to be looking at new knowledge.
After reading a part of it, I feel that it can only form a little system, and I have a little understanding. To sum it up here, this should be a series.
Basic Concepts of Operating Systems
In the logic of the operating system, the computer system is roughly divided into four parts from bottom to top, hardware, operating system, applications, and users.
Operating system refers to the control and management of the hardware and software resources of the entire computer system, the rational organization and scheduling of computer work and resource allocation, and then provide a convenient interface and environment for users and other software.
Features of the operating system
Concurrency
There are multiple programs in the operating system at the same time, so it has the ability to handle and schedule the simultaneous execution of multiple programs. The purpose of introducing processes is to enable concurrent programs.
Concurrency refers to multiple programs at the same time interval, while parallelism refers to multiple programs at the same time.
In a multi-program environment, over a period of time, macroscopically, multiple programs are executed simultaneously, while at each moment, only one program is actually executed in the case of a single processor.
Note here that multichannel refers to the fact that multiple programs can be concurrent, rather than having multiple processor cores
Share
Sharing, that is, resource sharing, refers to the fact that resources in the system can be used by multiple concurrently executing processes in memory.
- Mutual exclusion sharing method: Although some resources in the system, such as printers, can be used alternately by multiple programs, in order not to confuse the printed results, it should be stipulated that only one process is allowed to access it within a period of time, that is, in concurrent processes Processes can alternately use the CPU, but certain critical resources cannot be alternately used. ** This mutual exclusion is not a parallel mutual exclusion, but a concurrent mutual exclusion **.
Simultaneous access mode: Certain resources can be accessed alternately by parallel programs.
Virtual
Virtualization is the transformation of a physical entity into several logical counterparts. The physical entity actually exists, while the virtual is virtual and conceptual. The technology used to realize virtualization becomes virtual technology. Various virtualization technologies are used in the operating system to realize virtual processors, virtual memory, virtual network interface cards, virtual external devices, etc.
For example, our common four-core eight threads, in fact, four-core concurrency will only have four threads, that is, one core and one thread. The reason why it is said that one core has two threads refers to the sense of parallelism, which virtualizes one core into two.
Virtual technology can be divided into two types: time division to reuse technology, such as processor sharing; space division to reuse technology, such as virtual memory.
Asynchronous
The multi-program environment allows multiple programs to be concurrent, but due to limited resources, the execution of the process is not consistent in the end, but stop-and-go, which leads to the process moving forward at an unknown speed, which is the asynchronous nature of the process.
Asynchrony makes the operating system run in a random environment, which may lead to time-related errors in the process, and then as long as the running environment is the same, it must ensure that the execution result is the same, and the means to ensure this result is that we will be behind. The main discussions are scheduling, synchronization, and mutual exclusion of processes.
Functions of the operating system
In order to provide a good operating environment for multiple programs, the operating system should have: processor management, memory management, Facility Management, and file management.
In other words, if it wasn’t for dealing with Duo Dao, it wouldn’t be like this at all.
In order to facilitate the use of the user, the interface must be provided to the user.
Finally, the machine can be expanded at any time to provide more convenient services and higher resource utilization.
Managers of computer system resources
This part can be said to be the outline of the operating system.
Processor management: In a multi-program environment (a single-program environment does not need to manage processors, a simple queue is fine), the allocation and operation of processors are based on processes, so the management of ** processors can be It comes down to the management of processes **. Concurrency refers to the simultaneous running of multiple processes in a computer, so when processes are created, when to cancel, how to manage, how to avoid conflicts, and reasonable sharing are the main tasks of process management. ** The main functions of process management include process control, process synchronization, process communication, deadlock handling, processor scheduling **, etc.
Memory management: In order to provide a good environment for multi-channel programs, facilitate users and improve memory utilization, it mainly includes functions such as memory allocation and recovery, address mapping, memory protection and sharing, and memory expansion.
File management: The information in the computer exists in the form of files. The part responsible for file management in the operating system is called the file system. File management includes the management of file storage space, directory management, and file read and write management and protection.
Facility Management: The main task of Facility Management is to complete the user’s I/O requests, which is convenient for users to use various devices. Mainly includes functions such as buffer management, device allocation, device processing and virtual devices.
The operating system serves as the interface between the user and the computer hardware system
Operating system interfaces are divided into two types, one is the command interface, users use these commands to organize and control the execution of jobs (** Note here’job ', this concept is not the same as the process, it will be carefully said later, you can simply Think of it as the command line of cmd **), one is a program interface that programmers can use to request system services.
- Command interface
There are two main ways to use the command interface for job control, namely online control mode and offline control mode. According to the different job control methods, the command interface can be divided into online command interface and offline command interface.
The online command interface, also known as the interactive command interface, is suitable for time-sharing or real-time systems (these are the two different types of operating systems that will be mentioned later, let’s leave an impression here).
It consists of a set of keyboard operation commands. Users input operation commands through the Console or end point to make various service requirements to the system. Every time the user enters a command, the control is handed over to the system to parse the command and execute it.
The offline command interface, also known as the batch command interface, is suitable for batch operating systems (which is another type of operating system). It consists of a set of job control commands. Once the user enters a batch command, he cannot interfere with the job execution halfway through. The system receives this batch of commands and executes them in turn.
It should be noted here that this offline command interface belongs to the command interface, which is different from the programs we usually write.
- Program interface
The program interface consists of a set of system calls (generalized instructions). Users use these system calls in the program to request the operating system for its services, such as using various peripherals and requesting allocation of memory
Currently the most popular is the Graphical User Interface (GUI), that is, a graphical interface, such as those buttons in Windows. Strictly speaking, graphical interfaces are not part of the operating system, but graphical interfaces call system interfaces.
As an expansion machine
We refer to computers without any software support as bare metal, and machines covered with software are called expansion machines or virtual machines.
Development and Classification of Operating Systems
Manual operation stage (no operating system)
All operations performed by users on the computer require manual intervention, such as loading, running, and outputting the results of the program.
There are two outstanding shortcomings: the user occupies the whole machine, and the resource utilization rate is low; the CPU waits for manual operation and is not fully utilized.
Batch stage
In order to solve the shortcomings mentioned above, solve the human-machine contradiction and the speed mismatch between CPU and I/O, batch processing systems have emerged.
According to whether it is concurrent, it is divided into single-channel batch processing and multi-channel batch processing, that is, batch processing refers to a batch of jobs that can be input, rather than concurrency.
- Single-channel batch processing system
The system processes jobs in batches, but there is only one job in memory. The characteristics of a single-channel batch processing system are as follows:
Automation: When things go well, a batch of jobs on the tape can run automatically one by one without human intervention.
- Sequential: each job enters memory sequentially and then completes in order.
- Single track: Only one program runs in memory, that is, the supervisory program only transfers one job from the tape to the memory to run.
The problem with single batch processing is that there is only one job in memory, and if it is waiting for I/O, the CPU is idle, which reduces CPU utilization.
In order to solve this problem, multiprocessing, or concurrency, was introduced, which is the source of all evil in such a complex operating system.
- Multi-channel batch processing system
First of all, multichannel does not refer to concurrency, but multichannel introduces concurrency, or non-concurrency, multichannel has no meaning.
Multichannel means that multiple programs can enter memory at the same time. If they cannot be executed concurrently after entering memory at the same time, it is better not to enter memory.
** The reason for distinguishing this is to distinguish between job scheduling and process scheduling. Choosing what job goes into memory is job scheduling, while how multiple jobs are concurrent in memory is process scheduling. **
Multiprogramming technology allows multiple programs to enter memory at the same time and allows them to alternate. These programs share various software and hardware resources in the system…
The characteristics of multi-channel programs are multi-channel, macro parallel, micro serial (core solo):
- Multi-channel; multiple independent programs are stored in memory at the same time.
- Macroscopic parallelism: many programs entering the system at the same time are running, that is, they have started their respective runs, but they have not finished running.
- Microscopic Serial: Multiple programs in memory are executed in turn by the CPU.
The advantage is to improve resource utilization, the disadvantage is that the user response time is long, and does not provide human-machine interaction capability, the user inputs a series of job commands, can only wait for the result.
Time-sharing operating system
In order to solve the above problem of multi-channel batch processing jobs, time-sharing technology was created, which refers to dividing the running time of the processor into very short time slices, and distributing the processor to each online job in turn according to the time slices. If a job does not finish running in the time slice assigned to him, the execution of the job is suspended, the processor is given to other jobs, and the next round is awaited. Because the computer is fast in operation and the job rotation is fast, it gives each user the feeling that he has an exclusive computer.
It can be explained superficially that the ** time-sharing operating system provides a time-slice-based process scheduling ** on the basis of a multi-channel operating system.
Time-sharing operating system refers to multiple users sharing a host through an end point at the same time, and users can interact with the host at the same time without interfering with each other.
The key to implementing a time-sharing operating system is how to enable users to interact with jobs, that is, when the user types a command at the end point, the system can accept and process the command in time, and then return the result to the user.
Time-sharing operating systems support multichannel, but unlike multichannel, time-sharing operating systems provide human-machine interaction. This also makes time-sharing operating systems have the following characteristics:
Simultaneity: Also known as multiplexing, the value of multiple end users using a single host at the same time.
- Interactivity: The user directly controls the program operation through the end point by means of man-machine dialogue.
- Independence: Multiple users are independent of each other.
Timeliness: User requests can be responded to in a very short time.
And these are all based on time slice scheduling, and again, time slice scheduling is process scheduling.
Real-time operating system
In order to be able to complete within a specified time without waiting for a time slot to queue up, real-time operating systems were born.
There are two types. One is a hard real-time system, such as the flight automatic control system of an aircraft, where a specific action must be completed within a specified time. The soft real-time system that can accept occasional violations of the time limit without causing permanent damage.
The main features are timeliness and reliability.
In order to achieve this, priority and preemptive process scheduling are introduced here.
Network operating systems and distributed operating systems
The network operating system organically combines each computer in the computer network, provides a unified cost-effective method of using each computer, and realizes the mutual transmission of data between computers. The main features are the sharing of various resources in the network and the communication between computers.
Distributed computer system refers to a system composed of multiple computers and meets the following conditions: any two computers in the system exchange information through communication; each computer has the same status; resources are shared by all users on each computer; any computer in the system One computer can form a subsystem and can be reconstructed; any work can be distributed on several computers, and they work in parallel and cooperate to complete it. The main feature is misfortune and parallelism.
The essential difference between distributed and network operating systems is that several computers in a distributed operating system can cooperate with each other.