Operating System 1 - Introduction to Operating Systems

This series of blogs focuses on sorting out the core content of the operating system course of Shenzhen University, and the bibliography "Computer Operating System" (if you have any questions, please discuss and point out in the comment area, or contact me directly by private message).


synopsis

This blog mainly introduces the relevant knowledge of the introduction to the operating system in the first chapter of the operating system.

Table of contents

1. Operating system overview

2. The goal and function of the operating system

3. The development history of the operating system

Fourth, the basic characteristics of the operating system

Five, the main function of the operating system

Six, the structure design of the operating system

7. Some examples


1. Operating system overview

The operating system does not directly solve the final specific application problems, nor is it responsible for compiling source programs...

The operating system completes all "hardware-related, application-independent" work for you to give you convenience, efficiency and security

  • definition

An operating system is a set of programs that effectively controls and manages the hardware and software resources of a computer system, organizes computer workflow reasonably, and facilitates users.

2. The goal and function of the operating system

Currently, there are many types of OS, and different types of OS have different targets. The OS, which is usually configured on computer hardware, has the following goals:          

1. Convenience          

2. Effectiveness          

3. Scalability        

4. Openness 

As for the role of the operating system, different perspectives have different views.

1. From the perspective of computer system composition - operating system is system software 

Computer system composition:      

  • Software: application software, system software (operating system, language processing system and common routine service programs)
  • Hardware: input/output (I/O) devices, memory (memory), central processing unit (CPU)    

2. From the perspective of resource management programs - the operating system is the manager of system resources (processors, memory, I/O devices, and information (data and programs))

3. From the perspective of software layering and machine expansion - the operating system is the first layer of system software (virtual machine) to expand the bare metal

4. From the point of view of serving users - the operating system is the interface between the user and the bare metal

The main drivers of operating system development are:

1. Continuously improve the utilization rate of computer resources 2. Convenience for users 3. Continuous updating of devices 4. Continuous development of computer architecture 

3. The development history of the operating system

The development history of the operating system is mainly: 1. Manual operation mode 2. Off-Line I/O mode (single-channel batch processing -> multi-channel batch processing -> time-sharing system -> real-time system)

Single-channel batch processing is only one job in the memory . Multi-channel batch processing is used to improve resource utilization and system throughput . In order to meet user needs , a time-sharing system (multi-user, multi-task) has emerged. The main requirements are ( 1) Human-computer interaction, (2) Shared host, (3) Easy access for users. Among them, the most critical issue is how to enable users to interact with their own jobs .

An important indicator of a time-sharing system is the response time , which is the time interval between the user issuing a terminal command and the system starting to respond. Assuming that the number of users in the time-sharing system is n, and the running time slice of each user is q, the response time of the system is T=n×q. The time slice q allocated to each user consists of two parts, which are used for swapping time S and for real processing time T (processing).

T = n × q

q = S + T (processing)

The selection of time slice q in a time-sharing system is a complex and critical task.

  • If the time slice is selected too large, the number of users will decrease when the response time remains unchanged, or the response time will be too long
  • When the time slice is too small, the overhead of switching within a time slice is relatively increased, and a process takes relatively more time slices to run to completion, and the turnaround time of a process in the system is greatly increased
  • The optimal time slice value should not only enable time-sharing users to get good response time, but also make switching overhead relatively small and negligible within a time slice.

In general, the time-sharing system features are as follows:

  • Interactivity: The user has a human-computer dialogue with the system.
  • Multiplexing: Multiple users use the same CPU on their respective terminals at the same time.
  • Independence: Users can operate independently of each other without interfering with or confusing each other.
  • Timeliness: Users can get timely answers from the system in a short time.

For a real-time system, the so-called "real-time" means "timely", and a real-time system (Real-Time System) means that the system can respond to the request of an external event in a timely manner (or immediately) and complete the response to the event within the specified time. process , and control all real-time tasks to run in unison.

For real-time tasks, the deadline is generally associated with:

① Start deadline - the task must be executed before a certain time;

② Completion deadline—the task must be completed by a certain time.

Divide tasks according to deadlines:

(1) Hard real-time task. The system must meet the task deadline requirements, otherwise unpredictable results may occur.

(2) Soft real-time task. It is also associated with a deadline, but it is not strict. If the task deadline is occasionally missed, the impact on the system will not be too great.

Fourth, the basic characteristics of the operating system

1. Concurrency:

Concurrency is when two or more events occur within the same time interval

Tips: Parallelism means that two or more events occur at the same time

In a uniprocessor system, only one program can be executed at each moment, so microscopically, these programs can only be executed alternately in a time-sharing manner. Multiple CPU systems can run in parallel

2. Sharing:

In the operating system environment, so-called sharing means that resources in the system can be shared by multiple concurrently executing processes (threads) in the memory. Generally, there are (1) mutually exclusive sharing (printer, tape drive), (2) simultaneous access (disk).

3. Virtual:

The so-called "virtual" in the operating system refers to the transformation of a physical entity into several logical counterparts (virtual CPU, virtual memory, virtual peripherals, etc.) through a certain technology.

For example, a virtual processor uses multi-programming technology to allow multiple programs to execute concurrently to use a processor in time-sharing . Although there is only one processor, it can serve multiple users at the same time, making each end user think that there is a CPU serving him exclusively. That is, virtualize one physical CPU into multiple logical CPUs

4. Asynchrony:

In a multiprogramming environment, multiple processes are allowed to execute concurrently, but only after the processes have obtained the required resources can they execute. Due to the limitation of resources and other factors, the execution of the process is usually not "all in one go", but runs in a "stop and go" manner. The process advances at an unpredictable speed, which is the asynchronous nature of the process.

Five, the main function of the operating system

1. Processor management function:

  • Process control: process creation, resource allocation and management, state transition, revocation
  • Process synchronization: Make multiple processes run in an orderly manner (through mutual exclusion and synchronization mechanisms)
  • Process communication: exchange information between multiple processes (direct communication or indirect communication)
  • Process Scheduling: How to select an execution process from a queue

2. Memory management function:

  • Memory allocation: static and dynamic memory allocation (whether the space is determined and immutable)
  • Memory protection: ensure that each user program runs only in its own memory space without interfering with each other
  • Address mapping: convert the logical address in the address space to the corresponding physical address in the memory space
  • Memory expansion: With the help of virtual storage technology, logically expand the memory capacity, so that the user feels that the memory capacity is much larger than the actual memory capacity; or allow more user programs to run concurrently (request call-in, replacement)

3. Device management function:

  • Buffer management: set the buffer (single or double) to ease the conflict between the device and the CPU
  • Equipment allocation: According to the I/O request of the user process, the existing resource situation of the system and according to a certain equipment allocation strategy, allocate the required equipment for it
  • Device processing: used to implement communication between the CPU and the device controller

4. File management function:

  • File storage space management: the file system allocates the necessary external memory space for each file, improves the utilization of external memory, and can help improve the operating speed of the file system
  • Directory management: create directory entries for each file, and organize many directory entries effectively to achieve convenient access by name
  • File read/write management and protection: as the name suggests

5. User interface:

  • Command interface: (1) Online user interface: the user can control the job by typing in different commands successively (2) Offline user interface: entrust the system to control and intervene the job instead of the user
  • Program interface: the only way for user programs to obtain operating system services, mainly using system calls
  • Graphical interface: use the mouse or through menus and dialog boxes to complete operations on applications and files

Six, the structure design of the operating system

1. Meaning of software        

The so-called software refers to a collection of instructions and programs that can provide the required functions and performance when the computer is running. The program can correctly process the data structure of the information; The document used by the operation. If hardware is a physical component, then software is a logical component that has completely different characteristics from hardware.

2. The meaning of software engineering        

Software engineering refers to the use of systematic, standardized and quantifiable methods to develop, operate and maintain software; in other words, it uses engineering concepts, principles, technologies and methods to develop and maintain software, and its purpose is to In software development, there are problems such as random programming, unguaranteed software quality and difficult maintenance.

For the structure of the operating system, the traditional OS is mainly one to three generations (in order to control the complexity of the software, methods such as decomposition, modularization, abstraction, and concealment were introduced successively when developing the OS), and the OS structure of the microkernel is called for modern OS structures.

1. Unstructured operating system:

OS is a collection of a large number of processes, each process can call each other, there is no structure inside the operating system

2. Modular OS structure:

Based on the principles of "decomposition" and "modularization" to control the complexity of large software. In order to make the OS have a clearer structure, the OS is no longer directly composed of many processes, but the OS is divided into several modules with certain independence and size according to their functions. 

  • Disadvantages: First of all, when starting to design the OS, the division of modules and the regulations on interfaces are not precise, and there may be errors, so it is difficult to guarantee that the modules designed according to these regulations will be completely correct, which will make it difficult to control the OS in the future. Difficulties arise when these modules are assembled into an OS; secondly, when dividing modules from a functional point of view, shared resources and exclusive resources cannot be distinguished; due to differences in management, there will be complex dependencies among modules and the OS structure will become unclear.

3. Layered structure method:

Change the disordered calls between modules into ordered calls. It arranges all the functional modules of the OS into several layers according to the call order of the function flow diagram. The modules between the layers can only be one-way call relationships, that is, only Allow upper-level modules to call adjacent lower-level modules. 

4. Microkernel technology OS:

The so-called microkernel technology refers to a carefully designed small kernel that can realize the core functions of a modern OS. It is different from the general OS (program), it is smaller and more refined, it not only runs in the core state, but also stays in the memory after booting, it will not be swapped out of the memory due to memory shortage.

The functions provided by the microkernel are usually some of the most basic functions, such as process management, memory management, inter-process communication, and low-level I/O functions. 

7. Some examples

Choose 1. When designing a time-sharing operating system, the first thing to consider is ﹎﹎A﹎﹎; when designing a real-time operating system, the first thing to consider is ﹎﹎B﹎﹎; when designing a batch system, the first thing to consider is is ﹎﹎C﹎﹎.

A, B, C: (1) flexibility and adaptability; (2) interactivity and response time; (3) turnaround time and system throughput; (4) real-time and reliability.

A:(2)B:(4)C:(3)

Option 2. In order to improve the utilization rate of the computer's processor and external devices, put multiple programs into the main memory at the same time, and run them in parallel macroscopically. The design method is ﹎﹎B﹎﹎; multiple users interactively input, debug and control the operation of their programs on the terminal equipment is ﹎﹎C﹎﹎; a system composed of multiple computers, between these computers Can communicate to exchange information, there is no distinction between each other, they share system resources, and the program is executed by all or part of the computers in the system. The operating system that manages the above computer systems is ﹎﹎D﹎﹎; there is a type of operating system The importance of system response time exceeds the utilization rate of system resources. It is widely used in satellite control, missile launch, aircraft flight control, aircraft booking business and other fields is ﹎﹎E﹎﹎. A--E: ① Time-sharing OS ② Real-time OS ③ Batch processing system ④ Network OS ⑤ Distributed OS ⑥ Single-user OS ⑦ Multi-programming ⑧ Multi-programming ⑨ Concurrent programming

A: B:⑦ C:① D:④ E:②

First of all, multi-programming is designed to improve CPU utilization and give full play to the parallelism of various computer components. The main problem of filling 8 in blank A and blank B is executed at the same time, which is different from the macroscopic parallelism mentioned above. If the multiprocessor is used to realize the parallel execution of the program, you should choose 7; C mainly reflects the interactivity of the time-sharing operating system, choose 1; D mainly examines the distributed OS and network OS, the main functions of these two operating systems The difference is whether there is a primary or secondary among computers, choose 4; E reflects the timeliness of the real-time operating system, so choose 2

Guess you like

Origin blog.csdn.net/weixin_51426083/article/details/131498612