Operating System Introduction

1. Why have an operating system?

Modern computer systems are mainly composed of one or more processors, main memory, hard disks, keyboards, mice, monitors, printers, network interfaces and other input and output devices.
  Programmers cannot understand all the details of hardware operations . It is very tedious work to manage these hardware and optimize their use. This tedious work is done by the operating system . With him, programmers can benefit from these tedious work. Freed, you only need to consider the writing of your own application software. The application software directly uses the functions provided by the operating system to indirectly use the hardware.

Second, what is the operating system and operating system functions

  An operating system is a control program that coordinates, manages and controls computer hardware and software resources.

  The operating system is located between the computer hardware and the application software, and is essentially a software. The operating system consists of two parts : the kernel of the operating system (running in kernel mode, managing hardware resources) and system calls (running in user mode, providing a system call interface for applications written by application programmers).

  The above picture is where the operating system is located. The operating system should be divided into two parts:

  1. Hide the ugly hardware call interface and provide application programmers with a better, simpler and clearer model (system call interface) for calling hardware resources. After application programmers have these interfaces, they no longer need to consider the details of operating the hardware and can concentrate on developing their own applications.

For example, the operating system provides the abstract concept of a file. The operation of the file is the operation of the disk. With the file, we no longer need to consider the read and write control of the disk (such as controlling the rotation of the disk, moving the head to read and write data, etc.).

  2. The application's race request for hardware resources becomes orderly .

For example, many application software actually share a set of computer hardware. For example, there may be three application programs that need to apply for a printer to output content at the same time. Then program a competes for printer resources and prints, and then program b competes for printer resources, or it may It is c, which leads to disorder. The printer may print the content of a section and then print c..., a function of the operating system> is to turn this disorder into order.

 

3. History of operating system development

1. The first generation of computers (1940~1955): vacuum tubes and punched cards
  The computers of this period did not have an operating system, and all programming was to directly control the hardware. The programmer took his plug-in board into the computer room and put his plug-in board into the street computer. In the past few hours, he had exclusive use of the entire computer resources
  . Share resources and debug programs on the fly.
  Disadvantages: waste of computer resources, only one person uses it at a time.
    
2. The second generation of computers (1955~1965): transistors and batch processing systems
  . Programmers write programs on punched cards, which are then placed on a card reader. After collecting enough, these cards are read into magnetic tape. The room manager loads the tape onto the tape drive, the operator loads a special program that reads the job from the tape and runs the output to the second tape, when the job is all complete, remove the input and output tapes, take the output tape To the 1401 machine for offline printing.
  1401: I/O operation 7094: Calculation operation
  Features: A large wave of input is still calculated in sequence, and a large wave of output is accumulated
  Advantages: batch processing, saving time
  Disadvantages: 1. The process requires human participation and control; 2. The calculation process is still sequential Calculation-->Serial calculation
     3. The process of waiting for the result and re-commissioning of the programmer requires that other programs of the same batch have been completed. (Affects development efficiency)
    
3. The third generation computer (1965~1980): integrated circuit chip and multi-programming design
  Since the second generation computer has two sets of models:
  7094 large scientific computer: mainly used for scientific computing and engineering computing. (Word-oriented)
  1401 Business Computer: Mainly used in banking and insurance to engage in tape filing and printing services. (character oriented)
  IBM uses the system/360 series to meet the above requirements at the same time, the low-end machine is equivalent to the 1401, and the high-end machine is equivalent to the 7094.
  (1) Solve the problem of human participation:
  read the job from the card to the disk, so when a job ends at any time, the operating system can read a job from the tape and put it into the vacated memory area to run. This technology is called Simultaneous external device online operation: SPOOLING, this technology is used for output at the same time.

  (2) Solve the problem of serial computing:
   The CPU runs much faster than the speed of reading data from the hard disk, so the introduction of memory, the CPU can read the data in the memory very quickly.
  Multi-channel technology: Multi-channel refers to multiple programs, solving the orderly scheduling problem of multiple programs competing or sharing the same resource . use . Spatial multiplexing : multiplexing memory space, and         the problem of multiple program space multiplexing in memory at the same time: it is necessary to ensure that the memory of multiple programs at the physical level is isolated from each other. Otherwise, security and stability will be lost. It is precisely because of the problem of physical isolation of memory that the third-generation computer operating system is still multiplexed in batch time : everyone shares the time of the cpu. When one program is waiting for I/O, another program can use the cpu. If the memory If enough jobs can be stored at the same time, the utilization rate of the CPU can be close to 100%, which is similar to the overall planning method learned in elementary school mathematics. Switching situation: 1) It will be carried out when a process encounters io; 2) A process will switch if it occupies the CPU for too long, or the operating system will take away the execution authority of the CPU.   (3) Solve the problem of real-time debugging of your own programs like the first generation Time-   sharing operating system: multiple online terminals + multi-channel technology , the index computer can provide fast interactive services for many users, and all users think that they are exclusive computer resources
  

  
        


  UNIX: Ken Thompson developed a simple, single-user version of MULTICS. In order to make programs run on any version of unix, IEEE proposed a unix standard, posix (Portable Operating System Interface)
  minix: Teaching system
  Linux: Finnish student Linus Torvalds wrote it based on minix
    
4. Fourth generation computer (1980~present): personal computer

 

4. Summary

1. The role of the operating system:
  1. Hide ugly and complex hardware interfaces and provide a good abstract interface
  2. Manage and schedule processes, and make the competition of multiple processes for hardware in an orderly manner.
        
2. Multi-channel technology
  1. Background: For single core, achieve concurrency ( it looks like multiple processes are running at the same time, pay attention to the difference between parallel and parallel )  
  The current host is generally multi-core (several cores can be parallel at most) , then each core will utilize multichannel technology.
  There are 4 CPUs, a program running on cpu1 encounters io blocking, and will wait until the io ends before rescheduling, and will be scheduled to any one of the 4 CPUs, which is determined by the operating system scheduling algorithm.
  2. Spatial multiplexing: there are multiple programs in memory at the same time
  3. Time multiplexing: multiplexing a cpu time
  slice The state of the process is saved, so as to ensure that the next time it switches back, it can continue to run based on the position that was cut off last time

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325470525&siteId=291194637