Home  >  Article  >  Operation and Maintenance  >  What is the use of processor multi-threading?

What is the use of processor multi-threading?

anonymity
anonymityOriginal
2019-05-06 17:15:4029710browse

The role of processor multi-threading: it can prepare more data to be processed for the high-speed computing core and reduce the idle time of the computing core; it solves the load balancing problem, makes full use of CPU resources, and improves CPU usage. efficiency; several things can be completed at the same time without interfering with each other, which shortens the time required to handle a large number of IO operations or situations.

What is the use of processor multi-threading?

What is a processor?

Central processing unit (CPU), as the computing and control core of the computer system, is the final execution unit for information processing and program execution. Since its creation, CPU has made great progress in logical structure, operating efficiency and function extension.

Central processing unit (CPU) is one of the main devices of electronic computers and the core component of computers. Its function is mainly to interpret computer instructions and process data in computer software. The CPU is the core component of the computer that reads instructions, decodes them, and executes them. The central processing unit mainly consists of two parts, namely the controller and the arithmetic unit, which also include cache memory and the data and control bus that realize the connection between them. The three core components of an electronic computer are the CPU, internal memory, and input/output devices. The main functions of the central processing unit are to process instructions, perform operations, control time, and process data.

In computer architecture, the CPU is the core hardware unit that controls and allocates all hardware resources of the computer (such as memory, input and output units) and performs general operations. The CPU is the computing and control core of the computer. The operations of all software layers in the computer system will eventually be mapped to CPU operations through the instruction set.

The central processing unit mainly includes the arithmetic unit (Arithmetic Logic Unit, ALU, Arithmetic Logic Unit) and the cache memory (Cache) and the bus (Data), control and status that realizes the connection between them. Bus). It, together with internal memory (Memory) and input/output (I/O) devices, are collectively known as the three core components of electronic computers.

What is the use of processor multi-threading?

There has always been such a doubt. In today's multi-core and multi-threaded computer processors, how do several threads in a process run? (A small amount of resources are allocated by the system and JVM and finally switched in turn for time scheduling? Or are these threads allocated to different cores to run at the same time?)

How does the processor CPU handle threads?

The CPU uses a mechanism similar to time slice rotation, which means that when a process makes an execution request at the same time, other processes can only wait for it to complete before the CPU processes other requests. Other processes are equivalent to waiting in queue. Of course, in order to avoid the unlimited execution of a certain process, a time is generally limited. If it times out, the CPU switches threads according to a certain thread scheduling algorithm. It can be seen as many threads executing concurrently. In fact, there is only one thread running at a certain point in time.

For multi-core, each core has the same principle. But two cores can allocate resources through the system and execute different processes at the same time, which is more complicated.

Each process has a process number assigned by the CPU. Avoid confusion.

What are the benefits of having more CPU threads

Theoretically, one core can only correspond to one thread. Intel's hyper-threading technology uses idle CPU resources to integrate virtual threads. In terms of computing performance, it is not as good as the actual threads of the physical core. However, it can improve the parallel processing capability of the processor to a certain extent. Like out-of-order execution, hyperthreading is also a solution to improve processor usage efficiency.

CPU's multi-threading technology can prepare more data to be processed for the high-speed computing core and reduce the idle time of the computing core; it solves the load balancing problem, makes full use of CPU resources, and improves CPU usage. Using multi-threading, several things can be completed at the same time without interfering with each other, which shortens the time it takes to deal with a large number of IO operations or situations.

Just take the example you gave. When a core processes task A, not the entire core is involved in the work, and there are still large idle resources, and these resources can be used to preprocess one or more of B, C, and D. However, a major problem with hyper-threading technology is the competition with the main thread. For example, when both the virtual thread and the physical actual thread need to call a certain cache unit, the virtual thread will suspend its work;

However, if the unit is called by the virtual thread before the physical thread, then the virtual thread will affect The work of the physical main thread actually reduces the execution efficiency. The current generation of hyper-threading technology has made better improvements on this issue, so the effect is still good, although it cannot be compared with physical threads. A current dual-core, four-thread processor, such as the I3, can surpass physical three-cores in parallel computing and be on par with entry-level four-cores, which is already very good.

The above is the detailed content of What is the use of processor multi-threading?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn