What are the threads of a processor? differences with the nuclei
Table of contents:
- What are the cores of a processor
- What are processing threads?
- Programs, processes and threads
- The processes of the program
- The threads of a process
- Can we see those threads or threads in the system?
In this article we are going to take a moment to explain what are the threads of a processor or also called threads in English or programming threads, in order to identify the fundamental differences between these and the processor cores. Among the less expert and even the more advanced users, there is still quite a bit of confusion about this topic. That is why we have set out to clarify these terms to the extent possible.
This concept of processing threads is not essential to know when buying a processor for a normal user. In most cases, better more than less, that is almost always true. Where we do need to know what the threads are, is in the program development work. Depending on how an application is programmed and compiled, it will have more optimized execution for processors with more threads than cores. And this is where we will try to get in our explanation.
Index of contents
What are the cores of a processor
We will start by explaining what the cores of our processor are, so we will have this prior knowledge so as not to get confused.
We know that a processor is responsible for carrying out and executing the instructions of the programs that are loaded in the RAM memory of our computer. Practically all the instructions that are necessary to carry out the typical tasks on our PC, navigate, write, view photos, etc. pass through it. In the physical section, a processor is an integrated circuit made up of millions of transistors that form logical gates to pass or not pass the data bits in the form of energy, without further ado.
Well, this small chip houses different modules that we can call nuclei, in addition to other elements that we are not interested in now. Processors a few years ago had only one of these cores, and were able to process one instruction per cycle. These cycles are measured in Megahertz (MHz), the more MHz, the more instructions we can do every second.
Now we have not only one core, but several. Each core represents a subprocessor, that is, each of these subprocessors will execute one of these instructions, thus being able to execute several of them in each clock cycle with a multi-core CPU. If we have a 4-core processor, we can execute 4 instructions simultaneously instead of just one. So the performance improvement is quadrupled. If we have 6, then 6 instructions at the same time. This is how current processors are much more powerful than older ones.
And remember, these cores are physically present in our processor, it is not something virtual or created by code.
What are processing threads?
Threads, threads, or threads are not a physical part of the processor, not at least when it comes to more cores or something like that.
We can define a processing thread as the data control flow of a program. It is a means that allows managing the tasks of a processor and its different cores in a more efficient way. Thanks to threads, the minimum allocation units, which are the tasks or processes of a program, can be divided into pieces to optimize the waiting times of each instruction in the process queue. These chunks are called threads or threads.
In other words, each processing thread contains a piece of the task to be carried out, something simpler to carry out than if we introduce the complete task in the physical nucleus. In this way the CPU is able to process several tasks at the same time and simultaneously, in fact, it will be able to do as many tasks as it has threads, and usually there are one or two for each core. In the processors that have for example 6 cores and 12 threads they will be able to divide the processes into 12 different tasks instead of just 6.
This way of working makes the system resources be managed more equitably and efficiently. You know… he divides and you will win of all life. These processors are called multi-threaded. For now, what we must be clear about is that a processor with 12 threads will not have 12 cores, the cores are something of physical origin and the threads something of logical origin.
That surely has been somewhat abstract and difficult to understand, so let's see how it translates if we talk about the architecture of a program on our computer.
Programs, processes and threads
We all know what a program is, it is a code that is stored in our computer and that is destined to carry out a specific task. An application is a program, a driver is also a program and even the operating system is a program capable of executing other programs inside it. All of them are stored in binary form, since the processor only understands ones and zeros, current / non-current.
The processes of the program
To run a program, it is loaded into memory, RAM. This program is loaded by processes, which carry its associated binary code and the resources it needs to operate, which will be assigned "intelligently" by the operating system.
The basic resources a process needs are a program counter and a stack of records.
- Program counter (CP): it is called an instruction pointer, and it keeps track of the sequence of instructions that are being processed. Registers: it is a warehouse located in the processor where an instruction, a storage address or any other data can be stored. Stack: it is the data structure that stores the information related to the instances that a program has active in the computer.
Then each program is divided into processes, and is stored in a certain place in memory. Also, each process runs independently, and this is very important to understand because this is how the processor and the system are capable of executing multiple tasks at the same time, what we call a multitasking system. This processing system is the culprit that we can continue working on our PC, even if a program has been blocked.
The threads of a process
This is where the processing threads, called threads in operating systems, appear. A thread is the unit of execution of a process. We can divide the process into threads, and each of them will be a thread of execution.
If a program is not multi-threaded, the processes within it will only have one thread, so they can only be processed at one time. On the contrary, if we have multi-threaded processes, these can be divided into several pieces, and each of those threads shares the resources assigned to the process. So we said that multithreading is more efficient.
In addition, each thread has its own stack of records so that two or more of them can be processed at the same time, unlike a single process, which will have to be run all at once. Threads are simpler tasks that allow you to run a process in a split fashion. And this is basically the final function of the processing threads. The more threads, the greater the division of processes, and the greater the volume of simultaneous calculations and, therefore, the greater the efficiency.
We are not finished yet, we still have the pending question of What happens then with a core with a double thread ? We have already said that each kernel is capable of executing a single instruction at a time. The CPU has a complex algorithm that divides execution times in the most efficient way possible, thus assigning each task a certain execution interval. The change between tasks is so fast, it will give the feeling that the nucleus executes tasks in parallel.
Can we see those threads or threads in the system?
Not in too detailed a way, but yes, we can see them, both on Windows and Mac.
In the case of Windows, we will only have to open the task manager and go to " performance ". Then we will click on the link “ resource monitor ” below. In this new window we will have each process divided into CPU consumption and threads, these will be the threads.
In the Mac activity monitor, we will have directly the threads listed on the main screen.
This concludes our article on what CPU processing threads are. It is certainly a somewhat complex topic to explain and quite abstract, especially for users who do not fully understand how a processor works. But in this case we have good news because we also have a pretty good article talking about how a processor works and how the entire instruction cycle is performed.
Visit our articles on:
We hope that everything has been more or less clear, and we appreciate that you have chosen us to know more about this topic.
What are the cores of a processor? and the logical threads or cores?
We explain that they are the cores of a processor. The difference between one physical and another logical and if it really is worth it.
Xbox scarlett will have nuclei dedicated to ray tracing
It has been confirmed that the next console called Project Scarlett has dedicated Ray Tracing hardware.
Amd will continue adding more nuclei in its next cpus
AMD's Mark Papermaster has stated that they do not see any impending barriers preventing the number of cores / threads from increasing further.