Von Neumann architecture and understanding of operating systems

Before formally explaining the process, some basic knowledge needs to be laid. 

Table of contents

von Neumann structure

operating system


von Neumann structure

I believe this term is very familiar to everyone, our common computers, such as notebooks. Most of our uncommon computers, such as servers, obey the von Neumann system.

This picture:

 Until now, computers as we know them are all made up of pieces of hardware.

Input unit: including keyboard, mouse, camera, network card, tablet, etc.

Memory: Memory
Central Processing Unit (CPU):
Contains computing units and controllers , etc.

(calculator: arithmetic operation (1+1=2), logical operation (if statement...)

Controller: CPU can respond to external events, coordinate external events ready, such as copying data to memory)
output unit:
display, audio, network card, printer, etc.

According to the figure we also know:

The CPU reads data (data + code) from memory . From the perspective of data, we believe that the CPU does not directly interact with the peripherals.
To process data, the CPU must first load the data of the peripherals into the memory . From the perspective of data , we think that peripherals only directly interact with memory.

Summary: All devices can only deal with memory.

So at this time, I believe everyone can understand why the program must be loaded into memory first to run.

Because the CPU can only interact directly with memory.

We not only need to understand this picture, but also how the data flows in the actual process.

Please explain, from the time you log in to qq and start chatting with a friend, the data flow process. From the time you open the window, start sending him a message , to the data flow process after he receives the message.

 They also strictly obey the von Neumann structure.

What if it is changed to send a file ?

It is nothing more than that the input device on my end has changed from a keyboard to a disk, and the final output device on the opposite end has changed from a monitor to a disk.

operating system

The above is explained from the hardware structure, so now it's time to talk about the software.

Any computer system contains a basic collection of programs called an operating system (OS). Generally speaking, the operating system includes:

Kernel (process management, memory management, file management, driver management)
other programs (such as function libraries, shell programs, etc.)

 This is a general composition of a computer, as you can see,

Operating systems are designed to:

Interact with hardware and manage all hardware and software resources.
Provide a good execution environment for user programs (applications).

In the entire computer hardware and software architecture, the positioning of the operating system is: a pure "management" software.

How to understand "management" ?

In college, we know that there are principals, counselors and students. From a management point of view, the principal is the manager, and our students are the managed. If we take a lot of subjects, the principal does not need to meet with us, and can make decisions and dispose of us directly by looking at the data. This shows that the most important thing is to get the core data of the managed person to support management decision-making. Of course, although we can make decisions and dispose of us, there must always be an executor to carry out the principal's order, and this is counseling As a member , act as an executor.

Compared with the operating system, the operating system is the principal, the driver is the tutor, and the underlying hardware is the student .

In general, management is the management of the data of the managed data objects.

 

But if there are many students, the data is very large and messy , even if we only get the data and want to process it, it is not practical, so we can organize it .

We can define a structure for each student separately to store the relevant information of the student. Then assuming that there are 5000 students, it is enough to open a structure array with a size of 5000.        

Then suppose we want to expel the 3 students with the lowest scores at this time, then we need to find the 3 students with the lowest scores, and then we design a sorting algorithm, after finding out, then let it leave the school?

We also need to delete the data of these 3 students. There is no information about these 3 students in the database, and then the counselor asks them to leave school, which means they will be successfully expelled.

To sum up: first describe the managed object, then define the object according to the description type, and organize the object into an array -----------------> the management of students becomes Added, deleted, checked and modified the array!

The management of students is abstracted into data management, but the large amount of data needs to be organized, and it is back to what we just said before describing first and then organizing !

Describe each student.

reorganize 

 

Remember these six-character mantras! This is the core idea of ​​our management.

This way we understand the general concept.

Next, take bank management as an example to deeply understand the upper and lower layers of the operating system.

For example, there will be some infrastructure in the bank, such as tables and chairs, dormitories, computer equipment, etc., and then each facility will have a dedicated person to manage it, and these people will be managed by the president. For example, if a table is broken, the corresponding person in charge can report to the president, and the president can decide whether to buy a new table based on these data.

The president can be compared to this operating system. This is the same as the type just mentioned above.

 However, we found that many banks are operated at counters, which are packaged, and customers cannot directly use the computers in the bank. Instead, they are operated by specialists. Therefore, we cannot directly expose the internal information to customers.

The above commissioner is equivalent to the system interface provided upward by the operating system.

 

 Since LINUX is written in C language, these system interfaces are equivalent to functions provided by C language !

Still take the bank as an example. At this time, an illiterate person came to the counter. Since the counter staff could not understand what they said, a service layer was set up at this time. As long as you give me all the information, I can help you with these things.

This service layer is equivalent to the user interface in the operating system : for example, our graphical interface, shell shell, third-party library, etc., these are one step closer to our users' operation, and now I believe that many people will not use it. Obscure system interface bar.

Speaking of this, in fact, there are unlimited sets of shells. In short, the more sets, the more convenient it will be for people to use. 

That is to say:

From the perspective of development, the operating system will appear as a whole to the outside world, but it will expose part of its interface for upper-layer development. This part of the interface provided by the operating system is called a system call.
In the use of system calls, the functions are relatively basic, and the requirements for users are relatively high. Therefore, interested developers can properly encapsulate some system calls to form a library. With a library, it is very beneficial for higher-level users or Developers carry out secondary development.

Guess you like

Origin blog.csdn.net/weixin_47257473/article/details/131687983