When shopping for a computer
CPU has always been one of the most valued parameters
But how many friends only know how to talk to the clerk about the CPU
But I never knew what it really meant
We use mobile phone software every day, and all the calculations of computer software such as writing plans, typing code, and making PPT on the computer require CPU calculations.
In addition, the manufacture of spacecraft requires CPUs for upfront modeling work; Launch time, orbit, weather forecast, and fuel all require CPU simulation calculations; Post-launch real-time tracking, internal scheduling, and handling of emergency issues also require accurate CPU calculations.
It can be said that in the 21th century, CPUs played an important role in all aspects of life, work and science.
Today we're going to look at it:
What is CPU?
How does a CPU work?
What is the connection between CPU and GPU?
CPU
The central processing unit, referred to as CPU, is the core component of electronic computers and one of the most important devices in the information age.
The function of the CPU is mainly to process the data of computer software, convert human commands into machine language, and "make commands" to other computer devices, such as memory, graphics cards, motherboards, etc. It plays the role of "boss" in the overall computing system.
To put it more figuratively, the CPU is the human brain, and all information needs its participation or thinking.
The CPU is made up of three parts: a computer, a controller, and a register.
Combinators are mainly responsible for performing tasks, which can be understood as "beating workers", and its task is to be responsible for directly calculating relevant data;
The controller is similar to the "leader", the task is to give different orders to the "employee" according to different needs;
Registers can be understood as the group that communicates between the controller and the combinator, or it can be understood as the "secretary", whose main job is to coordinate the controller and the combinator.
The "department" of registers is very cumbersome, the controller will ask it to give commands to the combinator, and the combinator will calculate too much data, and it will also make the register temporarily register a part of it. Therefore, when there is too much data, the register is too busy, so it can only temporarily recruit some "temporary workers" - high-speed cache.
When the registers can't do their job, the cache is called to store the data. Of course, there are also hierarchies for temporary workers: Level 1 cache, Level 2 cache, and Level 3 cache. If the three slows are also exhausted, then leave it to the memory outside the CPU to cache.
But what if you don't have enough memory either? At this point, your computer starts to freeze.
CPU operation
In a large department, it is necessary to have a code of conduct in place so that the controller can give orders according to the rules. This code of conduct is the instruction set.
The instruction set may vary from device to device. For example, our computer uses the complex instruction set x86, while the instruction set of the mobile phone processor is the reduced instruction set ARM. The biggest difference between the two sets of instructions is the way the designer thinks about the problem.
As a simple example, such as ordering a person to eat, how should we give the instruction?
• Give him direct orders to "eat".
• Command him to "take a spoon first, scoop up a spoonful of rice, open his mouth, bring it to his mouth, and finally swallow it."
From here, it can be seen that the matter of "ordering people to eat" can be complicated or simple. And how to train that person, there are different understandings.
Some people think that if I first train the person receiving the command to master all kinds of complex skills (i.e., implement the corresponding complex function in hardware), then I can use very simple commands to make him do very complex things - for example, just say "eat" and he will eat, which is the idea of "complex instruction sets".
But some people think that this will make things too complicated, after all, the person receiving the order has to do very complicated things, and if you want him to eat at this time, then you have to train the eating skills. That being the case, why don't we divide things down into a number of very basic steps?
In this case, although the person giving the order is a little tired, only the person receiving the order needs to know very few basic skills to complete the same work - for example, now I want him to eat vegetables, and I only need to change the "scoop up a spoonful of rice" in the command to "scoop up a spoonful of vegetables", and the problem will be solved, which is the logic of "streamlining the instruction set".
We can see the difference between the instruction sets from the devices that make use of these two types of instruction sets.
• Performance: ARM is strong in efficiency, and its advantages can be fully exerted in some applications with relatively fixed tasks. X86 is still the "big brother" in terms of professional software or comprehensive work.
• Expansion capacity: In terms of mobile phones, we may not install expansion devices such as memory and storage until the product is eliminated, and the principle is that it is enough. Computers, on the other hand, can be bridged to expand many devices.
• Power consumption: X86 computers have strong performance, but power consumption has always been high, while ARM mobile phones only have a few watts of power consumption, so it is more suitable for portability and mobility.
CPU and GPU
With the rise of emerging technologies and the sudden epidemic, the rapid development of the GPU market has been promoted. GPU is the abbreviation of Graphics Processing Unit, which is a microprocessor specially designed for PC or embedded devices to perform image processing work. Yang Xudong, associate professor at the School of Computer Science at Beijing University of Posts and Telecommunications, said:
CPUs and GPUs have a lot in common, such as the fact that both are processors designed to accomplish computational tasks, and both follow the von · Neumann computer architecture. However, the difference between them is also obvious, the structure of the CPU belongs to the single-instruction single-data processing structure, and the logic calculation ability is strong; GPU is a single-instruction multi-data processing structure with strong data processing capabilities.
In other words, CPUs are good at dominating complex logic calculations, while GPUs are good at parallel data computing, so they are especially suitable for processing large amounts of data and uniformity.
For complex 3D rendering processing or 0D image processing, the CPU will spend a lot of resources to process, which will not only reduce the work efficiency in other aspects, but also affect the user experience. As a result, the CPU hands over some high-frame-rate game footage and high-quality special effects to the GPU.
But on the other hand, the GPU does not work alone and has to be controlled by the CPU to work. After the CPU sends out the instructions, the GPU receives its own task and starts working.
GPU was first used on personal computers, in order to solve multimedia data processing, and later applied on mobile intelligent terminals, and now people put GPU on the server side, commonly known as server GPU. With the development of communication technology/network technology, data processing is increasingly placed on server computing. Yang Xudong said that today's server GPUs can not only carry out professional visualization, computing acceleration, deep learning and other applications, but also support the development of a series of technologies such as cloud computing and artificial intelligence, which is expected to become the focus of future applications in the GPU industry.