Operating System 1: Basic Features and Main Functions of an Operating System

Table of contents

1. The goal and function of the operating system

(1) The goal of the operating system

(2) The role of the operating system

2. The development process of the operating system

(1) A computer system without an operating system

(2) Simple Batch Processing System

(3) Multiprogrammed Batch Processing System

(4) Time Sharing System

(5) Real Time System (RealTime System)

(6) Microcomputer operating system

3. The basic characteristics of the operating system

(1) concurrent

(2) Sharing

(3) virtual

(4) asynchronous

4. The main functions of the operating system

(1) Processor management function/process management

(2) Memory management function

(3) Device management function

(4) File management function


        An operating system is a collection of programs that can effectively organize and manage computer hardware and software resources, reasonably schedule various jobs, and facilitate users' use.

1. The goal and function of the operating system

(1) The goal of the operating system

        The main goals of configuring an operating system on a computer system are: convenience, effectiveness, scalability, and openness.

  • Convenience : making computers easy to learn and use
  • Effectiveness : The first meaning is to improve the utilization of system resources . In the early computer systems without an OS, such as processors and I/O devices, etc. were often idle, and various resources could not be fully utilized. Therefore, at that time, improving the utilization of system resources was the most important driving force for OS development. . Another meaning of effectiveness is to improve the throughput of the system . OS can improve the throughput of the system by rationally organizing the computer's workflow, speeding up the running of the program, and shortening the running cycle of the program.
  • Scalability : It is easy to add new functions and modules, and modify the original functions and modules
  • Openness : It means that the system can follow the world standard specifications, especially the open system interconnection OSI international standard. In fact, all hardware and software developed in accordance with international standards are compatible with each other and can be easily interconnected.

(2) The role of the operating system

        1 - The OS acts as an interface between the user and the computer hardware system

        The OS is between the user and the computer hardware system, and the user uses the computer system through the OS. In other words, with the help of OS, users can manipulate computer hardware and run their own programs conveniently, quickly and reliably.

        2 - OS as manager of computer system resources

        Resources in a computer system are divided into four categories: processors, memory, I/O devices, and files (data and programs) . Correspondingly, the main function of the OS is to effectively manage these four types of resources.

        3 - The OS implements the abstraction of computer resources

        As shown in the figure, the I/O device management software realizes the details of the I/O device operation, and abstracts the I/O device upwards into a set of data structures and a set of I/O operation commands, such as Read and Write commands, In this way, users can use these data structures and operation commands to perform data input or output without caring about how the I/O is implemented.

2. The development process of the operating system

(1) A computer system without an operating system

        All operations on the computer are performed manually. //Original machine, using paper tape, magnetic tape

        Manual operation seriously reduces the utilization rate of computer resources, which is the so-called man-machine contradiction . While the speed of CPUs is increasing rapidly, the speed of I/O devices is increasing slowly, which makes the speed mismatch between CPU and I/O devices even more prominent.

(2) Simple Batch Processing System

        In order to realize the continuous processing of jobs, it is necessary to first input a batch of jobs to the tape in an offline mode, and configure a monitoring program (Monitor) in the system. Under its control, the batch of jobs can be processed one by one. Continuous processing. // Solve the man-machine conflict

        1 - Process of a single-lane batch system

  • First, the supervisor program loads the first job on the tape into the memory, and hands over the operation control to the job;
  • When the job processing is complete, control is returned to the supervisory program, and then the supervisory program transfers the second job on the tape into memory.

        In this way, the computer system automatically processes one job after another until all jobs on the tape are completed, thus forming an early batch processing system. Although the system processes jobs in batches, only one job is always kept in the memory, so it is called a single-channel batch processing system .

        2 - Disadvantages of single-pass batch systems

        The main disadvantage of the single-pass batch processing system is that the resources in the system are not fully utilized . This is because there is only one program in the memory, and every time the program issues an I/O request during operation, the CPU is in a waiting state and must continue to run after its I/O is completed. And because of the low speed of the I/O device, the utilization rate of the CPU is significantly reduced. // CPU must wait during I/O

(3) Multiprogrammed Batch Processing System

        In the multi-channel batch processing system, the jobs submitted by the user are first stored in the external memory and arranged in a queue, which is called "backup queue". Then, according to a certain algorithm, the job scheduler selects several jobs from the backup queue and loads them into the memory, so that they can share the CPU and various resources in the system . Since several programs are installed in the memory at the same time, it is possible to use the CPU idle time when program A is suspended due to I/O operations to schedule another program B to run. During CPU idle time during O operation, program C is scheduled to run, so that multiple programs run alternately, so that the CPU can be kept busy. // Maximize the use of CPU idle time

        1 - Advantages and disadvantages of multi-channel batch processing systems

  • High resource utilization. The introduction of multi-channel batch processing can make multiple programs run alternately to keep the CPU busy; loading multiple programs in memory can improve memory utilization; in addition, it can also improve the utilization of I/O devices.
  • The system throughput is high. The main reason for improving system throughput can be attributed to: the CPU and other resources keep "busy" status, only switch when the job is completed or cannot continue, and the system overhead is small.
  • Average turnaround time is long. Because jobs are queued to be processed sequentially, jobs have a longer turnaround time, often hours or even days.
  • No interactivity . Once the user submits the job to the system, until the job is completed, the user cannot interact with his job, and it is extremely inconvenient to modify and debug the program. // Multi-channel batch processing UAV interaction capability

        2 - Problems to be solved in multi-channel batch processing system

        The multi-channel batch processing system is a very effective but very complex system. In order to make the multi-channel programs in the system run in a coordinated manner, the system must solve the following series of problems:

  • Processor contention problem. It should not only meet the running needs of various programs, but also improve the utilization rate of the processor.
  • Memory allocation and protection issues. The system should be able to allocate the necessary memory space for each program, so that they "have their own place", and will not destroy other programs due to an abnormal situation in one program.
  • I/O device allocation problem. The system should adopt appropriate strategies to allocate the I/O devices in the system, so as to not only facilitate the use of the devices by users, but also improve the utilization rate of the devices.
  • Document organization and management issues. The system should be able to effectively organize a large number of programs and data stored in the system so that they are not only convenient for users to use, but also ensure data security.
  • Job management issues. There are various jobs (application programs) in the system, and the system should be able to organize all the jobs in the system reasonably to meet the different requirements of users of these jobs.
  • User-system interface issues. In order to enable users to use the operating system conveniently, the OS should also provide an interface between the user and the OS.

        Accordingly, the definition of the operating system is derived: the operating system is a set of programs that can effectively organize and manage computer hardware and software resources, reasonably schedule various jobs, and facilitate the use of users. // Representative system: IBM OS/360 operating system

(4) Time Sharing System

       The main driving force for the formation and development of  multi-channel batch processing systems is to improve resource utilization and system throughput .

        The main driving force for the formation and development of time-sharing systems is to meet the needs of users for human-computer interaction .

        A time-sharing system refers to a system composed of multiple terminals equipped with monitors and keyboards connected to a host computer. This system allows multiple users to use their computers interactively through their own terminals at the same time, sharing the host computer. resources in .

        The key to realizing human-computer interaction lies in: timely acceptance and timely processing .

        In human-computer interaction, after users type in commands, they can control or modify their own jobs and their operations in a timely manner. Therefore, each user's job must reside in memory and get the processor to run frequently. Otherwise, the commands entered by the user will not be applied to their own jobs.

        Therefore, it is necessary to change the operation mode of the original batch processing system and adopt the following method instead: // Introduce the concept of time slice

  • Jobs go directly into memory. Since jobs cannot be run on disk, jobs should go directly into memory.
  • Rotational operation is adopted. If a job monopolizes the CPU and runs continuously, other jobs have no chance to be scheduled to run. In order to prevent a job from monopolizing the processor for a long time, the concept of time slice is introduced . A time slice is a very short period of time (for example, 30s). The system stipulates that each job can only run one time slice at a time, and then suspend the operation of the job, and immediately schedule the next job to run. If all the jobs can be executed for one time slice in a short period of time, each user can interact with their own jobs in a timely manner, so that the user's request can be responded to in a timely manner . // The emergence of time slices is to satisfy human-computer interaction, and each program can be processed by the processor

(5) Real Time System (RealTime System)

        The so-called "real-time" means "timely", and "real-time computing" can be defined as a type of computing: the correctness of the system is not only determined by the logical results of the calculations, but also depends on the time when the results are generated. In fact, the most important feature of a real-time system is that it takes time as a key parameter, and it must respond in a "timely" or "real-time" manner to certain signals it receives. From this, we know that a real-time system means that the system can respond to the request of external events in a timely manner, complete the processing of the event within the specified time, and control all real-time tasks to run in a coordinated manner . // weapon control system, embedded system, etc.

(6) Microcomputer operating system

        The operating system configured on a microcomputer is called a microcomputer operating system, and the earliest microcomputer operating system was CP/M configured on an 8-bit microcomputer. Later, 16-bit, 32-bit, and 64-bit microcomputers appeared, and corresponding microcomputer operating systems came into being. The microcomputer operating system can be divided according to the word length of the microcomputer, and it can also be divided into the following categories according to the operation mode:

        1 - Single-user single-tasking operating system

        The meaning of single-user single-task operating system is that only one user is allowed to be on the computer, and only the user program is allowed to run as one task. This is the simplest microcomputer operating system, mainly configured on 8-bit and 16-bit microcomputers, and the most representative The most popular single-user single-task microcomputer operating systems are CP/M and MS-DOS .

        2 - Single user multitasking operating system

        The meaning of a single-user multitasking operating system is that only one user is allowed to be on the computer, but the user is allowed to divide the program into several tasks so that they can be executed concurrently, thus effectively improving the performance of the system. Currently, operating systems configured on 32-bit microcomputers are basically single-user multitasking operating systems. Among them, the most representative one is Windows launched by Microsoft Corporation .

        3 - Multi-user multitasking operating system

        The meaning of multi-user multi-tasking operating system is to allow multiple users to use the same machine through their own terminals to share various resources in the host system, and each user program can be further divided into several tasks so that they can Concurrent execution, which can further improve resource utilization and system throughput. Most of the large, medium and minicomputers are equipped with multi-user and multi-tasking operating systems, while on 32-bit microcomputers, many are configured with multi-user and multi-tasking operating systems, the most representative of which is UNIX OS .

        The two most influential variants of the UNIX operating system that can run on microcomputers are Solaris OS and Linux OS .

3. The basic characteristics of the operating system

(1) concurrent

        Concurrency enables the OS to effectively improve resource utilization in the system and increase system throughput.

        1 - Parallelism and Concurrency

        Parallelism is when two or more events occur at the same time . Whereas, concurrency is when two or more events occur within the same time interval . In a multi-programming environment, concurrency means that multiple programs are running at the same time macroscopically for a period of time, but in a single-processor system, only one program can be executed at a time, so these programs are only It can be executed alternately in a time-sharing manner. // Concurrency -> Alternate execution

        2 - What is a process?

        A process refers to the basic unit that can run independently in the system and is used as a resource allocation . It is composed of a group of machines, data and stacks, and is an active entity that can run independently. Multiple processes can execute and exchange information concurrently.

(2) Sharing

        Resource sharing or resource reuse in the OS environment means that resources in the system can be shared by multiple concurrently executing processes in the memory. // There is contention between processes for shared resources.

        Currently, there are two main ways to realize resource sharing:

        1 - Mutually exclusive sharing : Only one process is allowed to access the resource within a period of time.

        When process A wants to access a resource, it must first make a request. If the resource is free at this time, the system can allocate it to the requesting process A for use. After that, if other processes want to access this resource, they must wait as long as A is not used up. Only after the A process finishes accessing and releases the system resource, can another process be allowed to access the resource. This resource sharing method is called exclusive sharing, and this kind of resource that only allows one process to access within a period of time is called critical resource (or exclusive resource) . Most physical devices in the system, as well as stacks, variables, and tables, are critical resources that can only be shared exclusively.

        2 - Simultaneous access mode : Multiple processes are allowed to access resources "simultaneously" within a period of time. // read the file simultaneously

(3) virtual

"Virtual" technology is to use "space division multiplexing" or "time division multiplexing" technology to change a physical channel into several logical channels, so that the physical channel that         can only be used for a pair of users can be used for multiple calls . Logical channel for users to talk at the same time . In the OS, the function of changing a physical entity into several logical counterparts through a certain technology is called "virtual". OS also uses time division multiplexing and space division multiplexing technology to realize "virtual" . // One physical entity corresponds to multiple logical objects

        1 - Time Division Multiplexing Technology -> Improve Processor Utilization

        In the computer field, the time-division multiplexing technology is widely used to realize virtual processors, virtual devices, etc., so that the utilization rate of resources can be improved. The fundamental reason why time-division multiplexing technology can improve resource utilization is that it uses the idle time of a certain device to serve a user, and then transfers it to serve other users, so that the device can be fully utilized.

        2 - Space Division Multiplexing Technology -> Improve Memory Utilization

For example, frequency division multiplexing technology ( which can be regarded as a kind of space division )         is used in the telecommunications industry to improve channel utilization. This technology divides a channel with a relatively wide frequency range into multiple channels (called frequency bands) with a narrower frequency range, and any one of the frequency bands can only be used by a pair of users to talk. The space division multiplexing technology is used in the management of the storage space in the computer to improve the utilization rate of the storage space.

        Summary: Multi-programming technology ( time-division multiplexing technology ) improves the utilization rate of the processor by using the idle time of the processor to run other programs . Then, the space-division multiplexing technology uses the free space of the memory to store and run Other multiprogramming, in order to improve memory utilization .

(4) asynchronous

        The process advances at an unpredictable speed, which is the asynchronous nature of the process. Asynchronous operation is allowed in the OS and is an important feature of the operating system.

4. The main functions of the operating system

(1) Processor management function/process management

        In the traditional multiprogramming system, the allocation and operation of processors are based on the process as the basic unit, so the management of processors can be attributed to the management of processes. The main functions of processor management are: creating and canceling processes, coordinating the operation of various processes, realizing information exchange between processes, and assigning processors to processes according to certain algorithms . // Process control, process synchronization, process communication, job or process scheduling

(2) Memory management function

        Memory management should have functions such as memory allocation and recovery, memory protection, address mapping and memory expansion .

        1 - Memory allocation and deallocation :

  • Allocate memory space for each program so that they "have their own place".
  • Improve memory utilization and minimize unusable memory space (fragmentation).
  • Allows running programs to apply for additional memory space to accommodate the dynamic growth of programs and data.

        2 - Memory Protection :

        The main tasks of memory protection are: // The process can only operate in the specified memory block

  • Ensure that each user program runs only in its own memory space without interfering with each other.
  • The user program is never allowed to access the programs and data of the operating system, and the user program is not allowed to be transferred to other non-shared user programs for execution .

        3 - Address Mapping:

        Memory management must provide an address mapping function, that is, the ability to convert a logical address in the address space into a corresponding physical address in the memory space. This function should be completed with the support of hardware. // Conversion of logical address and physical address

        4 - Memory Expansion:

        With the help of virtual storage technology, the memory capacity is expanded logically , so that the user feels that the memory capacity is much larger than the actual memory capacity, so that more user programs can run concurrently.

  • Request call function: load user program and data.
  • Replacement function: free up memory space, replace unused programs and data with programs and data that need to be transferred //Quasi-replacement algorithm

(3) Device management function

        The main tasks of device management are as follows: // Manage IO devices

  • Complete the I/O request made by the user process . Allocate the required I/O devices to the user process and complete the specified I/O operations.
  • Improve the utilization rate of CPU and I/O devices , increase the I/O speed, and facilitate users to use I/O devices.

        To achieve the above tasks, device management should have functions such as buffer management , device allocation and device processing , and virtual devices :

        1 - Buffer management : The introduction of buffering between the IO device and the CPU can effectively alleviate the contradiction between the speed mismatch between the CPU and the I/O device, improve the utilization rate of the CPU, and thus improve the system throughput.

        2 - Equipment allocation : The basic task of equipment allocation is to allocate the required equipment according to the I/O request of the user process, the existing system resources and according to a certain equipment allocation strategy.

        3 - Device Handling : A device handler is also known as a device driver. Its basic task is to realize the communication between the CPU and the device controller, that is, the CPU sends an I/O command to the device controller, requiring it to complete the specified I/O operation; otherwise, the CPU receives the I/O command from the controller. The interrupt request, and give a quick response and corresponding processing.

(4) File management function

        The main task of file management is to manage user files and system files for the convenience of users and to ensure the security of files. To this end, file management should have the functions of file storage space management, directory management, file read/write management, and file sharing and protection .

       1 - Management of file storage space : the main task is to allocate necessary external storage space for each file, improve the utilization rate of external storage, and then improve the storage and retrieval speed of the file system.

        2 - Directory management : the main task is to create a directory entry for each file, the directory entry includes the file name, the physical location of the file attribute file on the disk, etc., and organize many directory entries effectively to achieve convenient file management. Name access means that the user only needs to provide the file name to access the file.

        3 - Read/write management and protection of files :

  • File read/write management. This function is to read data from external storage or write data to external storage according to user's request.
  • file protection. In order to prevent the files in the system from being illegally stolen and destroyed, an effective access control function must be provided in the file system to achieve the following goals: prevent unauthorized users from accessing files; prevent impersonators from accessing files; Incorrect way to use files.

// The operating system is mainly elaborated around the above functions, which is also the basic framework for learning

        So far, the full text is over.

Guess you like

Origin blog.csdn.net/swadian2008/article/details/131081667