About operating system

Introduction to Operating System

1. Why is there an operating system

Modern The computer system is mainly composed of one or more processors, main memory, hard disk, keyboard, mouse, monitor, printer, network interface and other input and output devices.

Generally speaking, a modern computer system is a complex system.

One: if every application programmer must master all the details of the system, it will be impossible to write code (seriously affect the programmer’s development efficiency: mastering all these details may require a Wannian…)

Second: It is a very challenging task to manage these components and optimize their use. Therefore, a layer of software (system software) is installed in the calculation. For the operating system. Its task is to provide a better, simpler, and clearer computer model for user programs and manage all the devices just mentioned.

Summary:

Programmers cannot understand all the details of hardware operation. It is very tedious to manage these hardwares and optimize their use. This tedious task is the operating system. Yes, with him, programmers are freed from these tedious tasks. They only need to consider the writing of their 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

To put it simply, the operating system is a way to coordinate, manage and control computer hardware resources and software resources Control procedures. The location of the operating system is shown in the figure

ps: The operating system is located between computer hardware and application software, and is essentially software. The operating system consists of the operating system’s kernel (running in the kernel mode, managing hardware resources) and system calls (running in the user mode, providing system call interfaces for applications written by application programmers). Therefore, simply speaking of the operating system It runs in the kernel mode and is inaccurate.

Share pictures

What to say in detail , 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 for calling hardware resources (system call interface). After application programmers have these interfaces, they no longer need to consider the details of operating 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 Control the disk rotation, move the head to read and write data and other details).

2. Make the application’s competing requests for hardware resources orderly.

For example: Many application software actually share a set of computer hardware. For example, there may be three applications that need to apply for a printer to output content at the same time. Then a program competes for printer resources. Printing, then it may be b competes for printer resources, or it may be c, which leads to disorder. The printer may print a section of the content of a and then print c…, a function of the operating system is to change this Disorder becomes orderly.

share picture

3. The difference between operating system and ordinary software

1. The main difference is: you don’t want to use Baofengyingyin, you can choose to use Thunder Player or Simply write one yourself, but you cannot write a program that is part of the operating system (clock interrupt handler). The operating system is protected by hardware and cannot be modified by the user.

2. The difference between the operating system and the user program does not lie in the status of the two. In particular, the operating system is a large, complex, and long-lived software.

  • Large: The source code of Linux or Windows is on the order of 5 million lines. Calculated on the basis of a book with 50 lines per page and 1000 lines in total, five million lines would have 100 volumes, and a whole book shelf would be used to place them. This is only the core part. User programs, such as GUI, libraries, and basic application software (such as windows Explorer, etc.), can easily reach 10 or 20 times this number.
  • Longevity: The operating system is difficult to write. Once such a large amount of code is completed, the operating system owner will not easily throw it away and write another one. But to improve on the original basis. (Basically, you can see windows95/98/Me as an operating system, while windows NT/2000/XP/Vista are two operating systems. For users, they are very similar. There are also UNIX and its variants and The cloned version has also evolved for many years. For example, System V version, Solaris and FreeBSD are the original versions of Unix, but although linux is very imitated according to the UNIX model and is highly compatible with UNIX, linux has a brand new code base)

4. Operating system development history

The first generation of computers (1940~1955): vacuum tubes and punch cards

The background of the first generation of computers:

Before the first generation, humans wanted to replace them with machines Manpower, the birth of the first generation of computers is a sign that computers have entered the electronic age from the mechanical age. From the failure of Babbage to the Second World War, there was almost no progress in the construction of digital computers. The Second World War stimulated related computer research. Explosive progress.

Professor John Atanasoff of Lowa State University and his student Clifford Berry built what is believed to be the first working digital computer. The machine uses 300 vacuum tubes. At about the same time, Konrad Zuse built the Z3 computer with relays in Berlin, a group in Bletchley Park, England built Colossus in 1944, Howard Aiken built Mark 1 at Harvard University, William Mauchley of the University of Pennsylvania and his students J. Presper Eckert built ENIAC. Some of these machines are binary, some use vacuum tubes, and some are programmable, but they are all very primitive, and it takes a few seconds to complete the simplest calculations.

During this period, engineers in the same team designed, built, programmed, operated and maintained the same machine. All programming was written in pure machine language, and even worse, required Thousands of cables are connected to the plug-in board to form a circuit to control the basic functions of the machine. There is no programming language (and there is no assembly), and the operating system has never heard of it. The process of using the machine is more primitive, see “Working Process” below for details.

Features:

There is no concept of operating system
All programs are designed It is to directly control the hardware

Working process:

The programmer makes an appointment for a period of time on the computer timetable on the wall, and then the programmer holds his plug-in version Go to the computer room and connect his plug-in board to the computer. During these few hours, he has exclusive use of the entire computer resources, and the next group of people have to wait (more than 20,000 vacuum tubes are often burned out) ).

Later there was a punch card, you can write the program on the card, and then read it into the machine without using a plug-in board

Advantages:

< p>Programmers have exclusive use of the entire resource during the application period, and can debug their own programs immediately (bugs can be dealt with immediately)

Disadvantages:

< p>Waste of computer resources, only one person can use it in a period of time.
Note: There is only one program in the memory at the same time, which is called and executed by the cpu. For example, the execution of 10 programs is serial.

Second-generation computer (1955~1965): Transistor and batch processing system

Background of the second-generation computer:

Because Computers at the time were very expensive, so I thought it was natural to think of ways to reduce the waste of computer time. The commonly used method is a batch processing system.

Features:

Designers, production personnel, operators, programmers and maintenance personnel have a clear division of labor directly, and the computer is locked in a dedicated air conditioner In the room, run by professional operators, this is the’mainframe’.

With the concept of the operating system

With the programming language: FORTRAN language or assembly language, write it on paper, punch it into a card, and then take the card box to the input room , Hand it to the operator, and wait for the output interface while drinking coffee

Working process: illustration share pictureShare a picture

How the second generation solves the first Generation problems/disadvantages:

1. Collect a bunch of people’s input into a large wave of input,
2. Then calculate sequentially (this is problematic, but the second generation calculation also No solution)
3. Collect the output of a bunch of people into a big wave of output

The predecessor of the modern operating system: (see picture)

Advantages:

p>

Batch processing saves machine time

Disadvantages:

1. The entire process requires people to participate in control, and the tape is moved Come and move (the two little men in the middle)

2. The calculation process is still sequential calculation-“Serial

3. The programmer used to have a computer for a period of time, but now it must It is planned to be unified into a batch of operations, and the process of waiting for results and re-debugging requires other programs of the same batch to be completed (this greatly affects the development efficiency of the program, and the program cannot be debugged in time)

The third-generation computer (1965~1980): integrated circuit chip and multi-program design

< p>The background of the third generation of computers:

In the early 1960s, most computer manufacturers had two completely incompatible production lines.

One is word-oriented: large scientific computers, such as IBM 7094, as shown above, mainly used for scientific and engineering calculations

The other is character-oriented: commercial computers , Such as IBM 1401, as shown in the figure above, is mainly used by banks and insurance companies to engage in tape archiving and printing services

It is expensive to develop and maintain completely different products, and different users use computers for different purposes.

IBM tried to meet both scientific and commercial computing by introducing the system/360 series. The low-end models of the 360 ​​series are equivalent to 1401, and the high-end models are much more powerful than the 7094. Different performances are sold at different prices.

p>

360 is the first mainstream model that uses (small-scale) chips (integrated circuits). Compared with the second-generation computers that use transistors, the price/performance ratio has been greatly improved. The descendants of these computers are still used in large computer centers. This is the predecessor of the current servers. These servers process no less than a thousand requests per second.

How to solve the second-generation computer problem 1:

After the card is taken to the computer room, the job can be read from the card to the disk quickly, so When a job ends at any time, the operating system can read a job from the tape and load it into the free memory area to run. This technique is called
simultaneous external device online operation: SPOOLING, which is also used Output. When this technology is adopted, the IBM1401 machine is no longer needed, and there is no need to move the tape around (the two villains in the middle are no longer needed)

How to solve the second-generation computer Question 2:

The operating system of the third-generation computer widely uses the key technology that the second-generation computer’s operating system does not have: multi-channel technology

In the process of executing a task, if the CPU needs to operate the hard disk, it sends an instruction to operate the hard disk. Once the instruction is issued, the mechanical arm on the hard disk slides to read the data into the memory. During this period of time, the CPU needs to wait. It may be short, but it is already long and long for the cpu, so long that the cpu can do many other tasks. If we let the cpu switch to do other tasks during this period of time, the cpu will not be fully utilized. . This is exactly the technical background of multi-channel technology.

Multi-channel technology:

Multi-channel technology in multi-channel technology refers to multiple programs. The realization is to solve the orderly scheduling problem of multiple programs competing or sharing the same resource (such as cpu). The solution is multiplexing. Multiplexing is divided into multiplexing in time and multiplexing in space.

Space reuse: Divide the memory into several parts, and put each part into a program, so that there are multiple programs in the memory at the same time.

Share a picture

Time reuse: when While one program is waiting for I/O, another program can use the cpu. If enough jobs can be stored in the memory at the same time, the utilization of the cpu can be close to 100%, similar to the overall planning method we learned in elementary school mathematics. (After the operating system adopts multi-channel technology, it can control the switching of processes, or compete for the execution rights of the cpu between processes. This switching will not only be carried out when a process encounters io, but a process occupies the cpu for too long It will also switch, or the operating system will take away the execution authority of the cpu)

The biggest problem with space reuse is:

The memory between programs must be divided This segmentation needs to be implemented at the hardware level and controlled by the operating system. If the memory is not divided from each other, one program can access the memory of another program.

The first thing to lose is security. For example, your qq program can access the memory of the operating system, which means your qq can access the memory of the operating system. Get all the permissions of the operating system.

Secondly, stability is lost. When a program crashes, the memory of other programs may also be reclaimed. For example, if the memory of the operating system is reclaimed, the operating system will crash.

The operating system of the third-generation computer is still batch processing

Many programmers miss the first-generation exclusive computer and can debug their programs on the fly . In order to satisfy programmers who can get a response quickly, a time-sharing operating system appeared

How to solve the second-generation computer problem 3:

Time-sharing Operating system:
multiple online terminals + multi-channel technology

20 clients are loaded into the memory at the same time, 17 are thinking, 3 are running, and the cpu uses a multi-channel approach to process the memory For these three programs, since the instructions submitted by customers are generally short and rarely time-consuming, the index computer can provide fast interactive services for many users, and all users think that they have exclusive computer resources

CTTS: MIT successfully developed a CTSS compatible time-sharing system on a modified 7094 machine. The third-generation computer widely uses the necessary protection hardware (memory between programs is isolated from each other) ), the time-sharing system became popular

MIT, Bell Labs and General Electric decided to develop MULTICS that can support hundreds of terminals at the same time after the successful development of CTTS (the designers focused on building a A machine for the user’s calculation needs), obviously it was really going to go to heaven, and finally fell to death.

Later, Ken Thompson, a computer scientist at Bell Labs who participated in the development of MULTICS, developed a simple, single-user version of MULTICS, which was the later UNIX system. Based on it derives many other Unix versions, in order to make the program run on any version of Unix, IEEE proposed a Unix standard, namely posix (Portable Operating System Interface)

Later, in 1987, a small UNIX clone, minix, appeared for teaching use. Finnish student Linus Torvalds wrote Linux based on it

Fourth generation computer (1980 to present): personal computer

Leave a Comment

Your email address will not be published.