How many cores and threads of the CPU are suitable for? Is the subsequent Ghz the better the higher the number?

time:2022-11-27 03:04:41 source:scripttoolbox.com author:Power Supply
How many cores and threads of the CPU are suitable for? Is the subsequent Ghz the better the higher the number?

Take a simple example. The CPU is a bank, and everyone queues up to deposit and withdraw money to go through the formalities. There are several windows that are several threads, that is, the number of customers that can be served "simultaneously". The number of cores is equivalent to the number of employees, that is, the people who actually work. There are 4 cores and 4 threads, four employees and four windows, and one employee is responsible for one window. There is nothing to say. There are 4 cores and 8 threads, four employees and eight windows. One employee is responsible for two windows. However, the employee does not have a clone technique. When employee A is working in window 1, he cannot handle window 2 at the same time. This is called hyperthreading (Hyperthread). What is the difference between 4 cores and 8 threads and 4 cores and 4 threads? Or what are the benefits of hyperthreading? It depends on the situation. If 4 depositors come and go through the formalities in 4 windows, then 4C4T (4 cores and 4 threads, abbreviated below) and 4C8T are no different. But the actual situation is that there are more than 100 people sitting in the hall of the bank all the year round, and they have to go through the formalities. The procedures are often very complicated, requiring depositors to fill in 10,000,000 documents. If you keep going through the formalities for the first four depositors, the latter will wait until the cucumber dishes are cold, and the bank will be complained to the death. So let's do it like this: when depositor X fills in the documents, call depositor Y to go through the formalities, and after X fills out the document, let X come over to continue the process. However, when calling Y to come over, you have to temporarily put away the list and information related to X's depositor, and wait for X to come over next time to put away the Y-related things, and then take out X's things. At this time, the advantage of more windows, that is, more threads, is displayed. When X fills in the documents at the No. 1 window, staff A can go to the No. 2 window to go through the formalities for Y, and then go to the No. 1 window to continue the formalities for X. This saves time in packing things up and down, which can greatly improve efficiency. Because such switching is actually very frequent, it is still a lot of things in general. And the more tasks hyperthreading is, the better the effect is. To be more specific, although the clerk can only handle one order at a time, he has two eyes, two hands, one mouth and one brain. When dealing with a customer's list, you must first look at it with your eyes, then think about how to deal with it, and then use your mouth. Almost all orders are in this process, and when these three items are completed, it is considered a single order. But when the clerk started to think about it after reading the first list, his eyes were actually idle. When I started to make the first list, my eyes and mind were idle. Can't let her idle! Therefore, we ask that the staff should start to look at the next order of the customer with their eyes when they start to think about the first order, instead of waiting for the first order to be completely processed before looking at the second order. In this way, after thinking about the first list and starting to speak, you can immediately start thinking about the second list, and at the same time your eyes can look at the third list. In other words, the clerk can work on the first order in his hand, think about the second order in his mind, and look at the third order at the same time. To a certain extent, although the clerk does not have a clone technique, he is handling three orders at the same time, which is much more efficient, right? This is called pipeline. But sometimes for a saver, the first order can't be continued until the next one is completed. For example, a depositor needs to check the balance before remittance, and it is impossible to process the remittance list without knowing the balance. In addition, lists are not the same as lists, some lists require a long time to think about, and some lists do not need to be thought about at all. Therefore, sometimes a staff member is in charge of a window, and sometimes his hands, brains and eyes are idle. At this time, hyperthreading can better drain the residual value of the employee. For example, although he does not have the avatar technique, for example, he is doing formalities for X in the first window, and his eyes are idle for various reasons, so he can first look at Y's list in the second window. Therefore, the general desktop-level CPU has hyperthreading, and the notebook CPU eats hyperthreading. Because the size of the laptop screen indirectly limits the number of programs you open. For example, on a desktop computer, you can easily put the browser + PDF + Excel + Word on one screen to read and write, which is very efficient. On a small 12-inch screen, opening a large Excel is already a big head, and if you open something else and cut it, it really can't work. So the notebook is better to save the hyper-threading to reduce power consumption. GHz represents how many actions each employee can perform per second. Generally speaking, the more movements an employee can do per second, the faster he can work. However, this is not absolute. Some employees are veterans, and they can complete one thing in 10 movements. Some staff are inefficient, and it takes 30 actions to complete the same thing.

(Responsible editor:Chassis)