The Central Processing Unit (CPU) is the computing core and control core of the computer. It is composed of the computer, the controller and the register, and the bus that realizes the data, control and state connected between them. Its main function is to interpret computer instructions and process data in computer software.
The operation principle of CPU can be divided into four stages: Fetch, Decode, Execute, and Writeback. The CPU takes the instruction from the memory or cache, puts it into the instruction register, decodes the instruction, and executes the instruction.
CPU caches are classified into level-1 and level-2 caches. Level 1 cache, L1Cache. Integrated in the CPU, it is used to temporarily save data during data processing. Because the cache instructions and data work at the same frequency as the CPU, the larger the capacity of L1 cache, the more information is stored, which reduces the number of data exchanges between the CPU and memory, and improves the computing efficiency of the CPU. The size of the L1 cache is usually between 32 and 256KB. Level 2 Cache, namely, L2 Cache. Due to the limitation of the capacity of L1 level cache, in order to improve the computing speed of the CPU again, a high speed memory is placed outside the CPU, namely the second-level cache. When the CPU reads data, it looks first in L1, then from L2, then memory, then external memory.
The main performance parameters of a CPU include main frequency, double frequency, and external frequency. The main frequency of the CPU is also called the clock frequency. The main frequency of the CPU is the rated working frequency of the CPU. When the number of cores is the same as the cache size, the higher the main frequency, the better the CPU performance and the higher the main frequency, the faster the CPU processes data.
The distinction between external frequency and double frequency is mainly related to the development of CPU. Because CPU development is too fast, and other hardware can not reach the same frequency to interact, so the CPU compromises, the external frequency as the frequency of communication with other components of the motherboard, and the working frequency by frequency doubling to adjust and improve.
The main frequency of the CPU is the CPU Clock Speed. That is, the CPU is usually referred to as xx MHz.
The external frequency is the base frequency of the CPU in MHz. The external frequency of the CPU determines the running speed of the whole motherboard.
Frequency doubling coefficient refers to the relative ratio between the CPU main frequency and external frequency. In general, the same generation (the same pin) of the CPU, its external frequency is often the same, but the change of frequency doubling coefficient leads to the main frequency is different.
A multi-core processor integrates multiple cpus (cores) into a single Integrated Circuit Chip. A dual-core CPU has 2 central processing units, and the operating system can see the true 2 cores, so 2 different processes can be executed simultaneously in different cores, which greatly speeds up the system. Since both cores are on the same chip, communication between them is also faster and the system has less latency.
Hyper Threading is essentially a simultaneous multi-threading technology that allows a CPU to execute multiple control flows. Its principle is to use one CPU as two, turning one hyperthreading physical CPU into two logical cpus, and logical cpus to the operating system, and physical cpus are no different. Therefore, the operating system assigns worker threads to the two cpus for execution, allowing multiple threads of an application to be executed simultaneously on the same CPU. Note: The two logical cpus share all the execution resources of a single physical CPU. In fact, hyperthreading is the virtualization of the CPU.
Second, the classification of CPU architecture
CPU architecture is a specification for CPU products made by CPU manufacturers to distinguish different types of cpus. There are two main categories of cpus in the current market: one is complex instruction set CPU led by intel and AMD, and the other is reduced instruction set CPU led by ARM. So what is a complex instruction set? What is a reduced instruction set? Before looking at the X86 and ARM CPU architectures, let’s look at the CISC complex instruction set and the RISC Reduced instruction set.
CISC (Complex Instruction Set Computer) complex instruction system is designed to enhance the function of original instruction and set more complex new instruction to realize the hardware of some large number of repeated software functions. Due to the low mainframe frequency and slow running speed of early computers, in order to improve the computing speed, more complex instructions have to be added to the instruction system to improve the processing efficiency of the computer, slowly forming a complex instruction system computer headed by the desktop computer.
Reduced Instruction Set RISC (Reduced Instruction Set Computer) takes the essence from CISC to remove the dross, simplifies the instruction function, reduces the average execution cycle of instructions, and achieves the purpose of improving the main frequency of computer work. At the same time, a large number of general instruction registers are introduced to reduce the unnecessary reading and writing process. Improve the subroutine execution speed, so that the program running time is shortened and reduced addressing, improve the compilation efficiency, and finally achieve the purpose of high performance.
According to the instruction set architecture, cpus are divided into CISC complex instruction set and RISC reduced instruction set.
The product architecture of cpus of different brands is also different. The main representatives of X86 architecture are Intel, AMD, domestic Haiguang, etc. ARM architecture companies include ARM, Ampere and domestic Feiten. One of the PowerPC architecture companies is IBM. Here we mainly look at the mainstream X86 architecture and ARM architecture.
The X86 architecture is a generic term for a microprocessor architecture first developed and manufactured by Intel. It also identifies a general set of computer instructions. X has nothing to do with the processor, but is a simple wildcard definition for all x86 systems. The x86 architecture is important for the complex instruction set (CISC) of variable instruction length.
The ARM architecture is a 32-bit reduced instruction set (RISC) processor architecture. ARM processor is very suitable for the field of mobile communication due to the characteristics of energy saving, the target effect is low power consumption. Unlike Intel, ARM does not manufacture or sell chips. Instead, ARM designs its own IP cores, including instruction set architectures, microprocessors, Gpus, interconnect architectures, and so on. It licenses them to anyone who wants to use them, and then collects royalties from each product it actually builds.
ARM authorization is divided into three types, namely architecture authorization, kernel authorization and usage authorization. Respectively corresponding to large and small companies, stick a brand can say their own CPU, for the wide use of ARM processor to lay a solid foundation.
1) Architecture license: It means that the enterprise has purchased architecture-level ARM processor design and manufacturing license. After obtaining the architecture authorization, enterprises can start from the whole architecture and instruction set, greatly transform the ARM architecture, and even expand or reduce the ARM instruction set, so as to achieve different purposes such as higher performance, lower power consumption or lower cost.
2) Kernel authorization: Kernel authorization means that users can apply the purchased ARM core to their own designed chips. But users are not allowed to modify the ARM core itself.
3) Authorization: Users with authorization can only purchase the packaged ARM processor core, and if they want to achieve more functions and features, they can only achieve it by adding DSP core outside the package.
At present, in the field of mobile chips, ARM architecture chips occupy more than 90% market share, in the server CPU market, Intel X86 processors occupy more than 90% market share. However, CISC and RISC architecture, two major CPU instruction systems, are learning from each other and moving towards integration. CISC borrows the concept of RISC to optimize the efficiency of instruction system, and RISC introduces enhanced instructions to improve the efficiency of complex task processing. The complex instruction set of CISC is characterized by multiple instructions, with one instruction executing multiple functions. The advantages are high efficiency in the execution of specific functions, such as multimedia processing; The disadvantage is complex system design and low execution efficiency. RISC reduced instruction set is characterized by fewer instructions and complex tasks are completed by multiple reduced instruction combinations. The advantages are high execution efficiency and low power consumption; The disadvantage is the low efficiency of some complex tasks, such as multimedia processing.