I. Basic concepts of the Operating System
1. Computer System Resources
In computer systems, there are two types of resources: hardware resources and software resources. Software resources are the soul of computers, mainly including various programs and data as well as the operating system itself. One of the important tasks of the operating system is to manage hardware and software resources in the computer in an orderly manner, track resource usage, meet users' requirements for resources, and coordinate resource usage conflicts of various programs, it provides users with simple and effective resource usage methods to maximize the sharing of various types of resources, improve resource utilization, and thus improve the efficiency of computer systems.
2. Hierarchy of computer systems
A computer installed with an operating system is called a Virtual Machine (VM). It is an extension of bare metal. Based on the composition and functions of the computer system, the computer system can be divided into four layers: hardware layer, operating system layer, utility layer (or supporting software layer), and application layer. Each layer represents a set of functions and an interface, and represents a one-way service relationship, that is, the software at the previous layer must use the services provided by the next layer of software or hardware in a way agreed in advance.
The hardware layer includes all hardware resources and provides basic computing resources. It is the basis for operating systems and upper-layer software. Its external interface consists of a machine command system. The operating system and its outer software access and control various hardware resources by executing machine commands.
The operating system layer mainly schedules and allocates resources, accesses and protects information, and coordinates and controls concurrent activities. The operating system is the basis for running other software and provides powerful support for the designers of system programs such as compiling programs and database management systems.
The utility layer is a basic component of computer system software, it usually includes compilation programs, text editing programs, debugging programs, connection programs, system maintenance programs, text encryption programs, terminal communication programs, graphic processing software, and database management systems in various languages. Its function is to provide services for application-layer software and end users to process their own programs or data.
The application layer is located at the outermost layer of the computer system to solve different application problems of users. application developers use programming languages to express application problems and develop various applications, which is fast and convenient. The end user solves the application problem by interacting with the computer. This includes applications developed by users with the support of operating systems and utilities, as well as specialized application packages (such as financial software and Office suites) developed by software vendors for industrial users. The application layer is the interface used by the end user. Of course, from the perspective of end users, in addition to using the application layer software, you can also use the features of some hidden utility layer, operating system layer, and hardware layer to process your own programs and data.
3. Operating System Hierarchy
The operating system is divided into the system layer, management layer, and application layer. The inner layer is the system layer, which has the functions of primary interrupt processing, external device driver, Processor Scheduling, and real-time process control and communication. Outside the system layer is the management layer, including storage management, I/O processing, file access, and job scheduling. At first, the operating system was designed to be a task that can execute repeated operations. These tasks are centered on managing files, running programs, and receiving commands from users. Files are electronic data or programs stored on hard disks, floppy disks, tapes, and other storage devices. Most users require computers to execute tasks such as reading and writing files from a disk drive or printing files on a printer. If you do not have an operating system, you need to generate and run a program to complete these tasks. However, in the operating system, you can simply send a command to the operating system to execute such a task. The operating system has included the design of repeated operations for reading files from the disk.
The outermost layer is the application layer, which is an interface for receiving and interpreting USER commands. This user interface allows users to interact with the operating system. Some operating system user interfaces only allow the input of command lines, while some can be implemented through menus and icons. The operating system also manages applications, which are special applications used to edit documents or scientific computing tasks. An editor is a typical application example that allows you to edit, change, or add text to a document. The editor itself is a program that contains a series of commands. To use this program, you should first load it into the computer memory and then execute its commands. The operating system controls the loading and execution of all programs and applications.
Ii. Operating System
The operating system is the core of computer system software and has multiple classification methods. Based on the functions provided by the operating system, the system can be divided into batch processing operating systems, time-based operating systems, real-time operating systems, single-user operating systems, network operating systems and distributed operating systems.
1. Batch Processing Operating System
The batch processing operating system is an early operating system used on the mainframe. It features that users use computers offline, batch processing jobs, and multiple programs to run. The batch processing operating system requires the user to prepare the homework for solving the problem on the computer in advance, including the program, data, and job instructions, and then directly hand it over to the system operator, and receive the running result at the specified time, users do not deal with computers directly. The system operator does not input the job immediately, but does not input the job in batches until a certain time or a certain number of jobs have been reached. The system operator processes the Jobs submitted by the user in batches, and the jobs in each batch are controlled and executed by the operating system.
2. Time-sharing Operating System
The time-sharing operating system allows multiple users to share the resources of the same computer, that is, connecting several or even dozens of terminals on one computer, the terminal can have no CPU and memory, only the keyboard and display, each user uses the computer's resources through their respective terminals, and the computer system takes turns to serve each terminal at a fixed time segment. Because the processing speed of the computer is very fast and the user does not feel the waiting time, it seems that this computer serves itself as well. The main purpose of a time-sharing operating system is to respond to services of on-premise users. It features the same timeliness, independence, timeliness, and interactivity. In a time-sharing operating system, time-sharing refers to the sharing of CPU running time by several programs by setting up a unit of time slices. That is to say, the CPU executes each job in turn by time slice. A time slice is usually dozens of milliseconds.
3. Real-time Operating System
With the need for industrial process control and real-time information processing, a real-time operating system is generated. "Real-time" means "immediate", which means to respond to and process random external events in a timely manner. Real-time operating system means that the system can respond to external event requests in a timely manner, process the event within the specified time, and control all real-time tasks to run in a coordinated and consistent manner. Real-time systems are Supervision and Control Systems with few human intervention. Their software depends on the nature of applications and the type of computers actually used. The basic feature of a real-time system is the event-driven design, that is, when a certain type of external information is received, the system selects the corresponding program for processing. The real-time operating system is characterized by responding within the allowed time range, requiring computers to process external information quickly enough, the response speed of the controlled object is in seconds, milliseconds, or microseconds or even smaller, which is usually used in industrial process control and real-time information processing. Industrial Control mainly includes automatic control of numerical control machine tools, power production, aircraft, missile launch, and other aspects; real-time information processing mainly includes querying flight routes and fares in civil aviation and financial processing in the banking system. Real-time Operating systems are characterized by high responsiveness, high reliability, and high security. The main difference between a time-based operating system and a real-time operating system is that, in terms of interaction capability and response time, a time-based system focuses on interaction, while a real-time system has a high response time requirement. UNIX is a typical multi-user, multi-task, time-based, real-time multi-time-based operating system, which is usually used in large, medium, small computers or workstations.
4. single-user operating system
A single-user operating system is developed with the development of a microcomputer. It is used to manage the hardware and software resources of a computer. It is generally divided into two types: single-user single task and single-user multi-task.
The main feature of a single-user single-task operating system is that only one user process can be run in one computer system at a time. This user exclusively occupies all hardware and software resources of the computer system. Commonly used single user single task operating system MS-DOS, PC-DOS, etc.
A single user multitasking operating system also serves a single user, but it allows the user to submit multiple tasks at a time. For example, you can start editing another document while running the program, while listening to music and typing is also a typical example. Commonly used single-user multi-task operating systems include 0 S/2 and Windows 95/98 series. Such operating systems are usually used in microcomputer systems.
5. Network Operating System
The network operating system is used to manage and control the hardware and software resources of multiple computers, and provides the function of sharing network communication and network resources. It is a collection of programs responsible for managing network resources and facilitating network users. It must ensure the accuracy, security, and confidentiality of information transmission in the network, and improve the utilization and reliability of system resources.
In addition to the five basic functions of the general operating system, the network operating system should also have a network management module. The main function of the network management module is to provide efficient and reliable network communication capabilities, and provide a variety of network services, such as remote job input service, time-sharing service, and file transmission service; manage shared resources on the network to achieve network security management.
The network operating system allows you to use the operating commands provided by the system to deal with multiple computer hardware and software resources, which are usually used on servers in the computer network system. The most representative network operating system products are Microsoft's Windows 2000 Server/Windows XP, UNIX, and Linux.
6. distributed (multi-processor) Operating System
A distributed system is a system composed of multiple computers connected by network. Any two computers in the system can exchange information through Remote Procedure Call (RPC, Remote Process Call, computers in the system have no primary or secondary knowledge. Resources in the system are shared by all users. A program can run on several computers in parallel to complete a common task. The introduction of distributed systems mainly aims to increase the processing capability, save investment, and improve the reliability of the system. The operating system used to manage distributed system resources is called a distributed operating system.
III. Basic functions and features of the Operating System
1. Operating System Functions
From the perspective of resource management, the functions of the operating system to control and manage computer resources are divided into the following five parts:
(1) CPU control and management: CPU is the most important hardware resource in the computer system. Any program can run only when it occupies the CPU, the information processing speed is far faster than the memory access speed and external device operation speed. Only by coordinating the relationship between them can we make full use of the CPU function. The operating system allows the CPU to provide services to external devices and users in turn based on predefined priorities and management principles, or to process multiple tasks in parallel within the same period of time to share resources, this maximizes the efficiency of computer systems.
(2) Memory Allocation and Management: computers not only need hardware resources to handle problems, but also many software resources such as operating systems, compiling systems, user programs, and data, when these software resources are stored in the memory and where user data is stored, the operating system must uniformly allocate and manage the memory to keep them in touch, avoid mutual interference. How to rationally allocate and use limited memory space is an important task of the operating system for memory management.
(3) control and management of external devices: the operating system controls the channels between external devices and CPUs, queues external devices that request requests in a certain order of priority, and waits for the CPU to respond. To improve parallel operations between the CPU and the input/output devices, and to coordinate the pace of operation between high-CPU and low-speed input/output devices, the operating system usually sets some buffers in the memory, enable the CPU and external devices to transmit data in batches through the buffer zone. The data transmission method is to first read a group of data from an external device to the memory buffer, and the CPU reads data from the buffer in sequence, after the data in the buffer zone is used up, read a group of data from the external device to the buffer zone. In this way, data exchange between CPU and input/output devices is performed in groups, which reduces the number of interactions between CPU and external devices and increases the computing speed.
(4) file Control and Management: stores logically complete information sets with a name as a whole record and stores it on the storage device. This whole information is called a file. To distinguish files with different information, they are named respectively, called file names. For example, a source program, a batch of data, a document, a table, or an image can all form a file. The operating system can access files by file name according to user requirements. It is responsible for controlling the file organization, file access permissions, and printing.
(5) Control and Management of jobs: jobs include procedures, data, and control steps for solving problems. A computing problem is a job, and printing a document is also a job. The operating system organizes and manages all jobs that enter the system to improve operational efficiency. The job management function of the operating system provides the "Job control language" through which you can write instructions for controlling job execution. At the same time, it also provides operators and end users with a "command language" to talk to the system and use it to request system services. The operating system controls the execution of user jobs according to the instructions or commands received.
2. Operating System features
The operating system is the core of the system software. It is equipped with an operating system to improve the processing capability of the computer system, give full play to the utilization of system resources, and make it easier for users to use. Currently, parallel operating technology is widely used in operating systems, enabling multiple hardware devices to work in parallel. For example, the CPU and I/O operations are parallel, and multiple programs are stored in the memory at the same time. These technologies show the main characteristics of the concurrency and sharing of the operating system.
Concurrency refers to storing multiple jobs in the memory. in a period of time, each job can push forward to different degrees. However, at any time point, only one job can occupy the CPU, each program is executed in turn on the CPU at the same time. The two concepts related to concurrency are: Serial. Only one job can be put in the memory at a time. Only after it is fully executed can other jobs be executed in the memory. In parallel, in an environment with multiple CPUs, multiple jobs are stored in the memory. At any time point, multiple jobs may be executed simultaneously on different CPUs.
Sharing means that resources in the system can be used by multiple concurrent programs in the memory. Many types of resources (such as CPU and memory) can be shared by multiple jobs.
Concurrency and sharing are the basic features of the operating system.