Multi cores processor and register

  • Thread starter Stephanus
  • Start date
  • Tags
    processor
In summary: Yes, the number of registers in each physical core.And it is enabled by the OS?It is enabled by the OS.When I use google search on "what is hyperthreading" it is the first result.In summary, hyper-threading is a technology that allows a processor to have multiple sets of registers.
  • #1
Stephanus
1,316
104
Dear PF Forum,
I have a question (after many questions) about multi cores processor.
Does multi cores processor has multi set of register?
Supposed an Intel xeon processor has 4 cores.
Does it processor have 4 EAX register?
E4 BX, 4 ECX, etc?

Thank you very much.
 
Computer science news on Phys.org
  • #3
jedishrfu said:
As far as the actual assembly is concerned, as Nicholas wrote, there's no difference between the assemblies for a single threaded or multi threaded application. Each logical thread has its own register set, so writing:

mov edx, 0

will only update EDX for the currently running thread. There's no way to modify EDX on another processor using a single assembly instruction. You need some sort of system call to ask the OS to tell another thread to run code that will update its own EDX.
Wow, thank you thank you very much @jedishrfu.
 
  • #4
And also they don't share register, but they share RAM. So I think there's some locking mechanism. Or if there isn't, then it does not matter. As long as each process (OS managed) works in their own address range.
 
  • #5
Dear PF Forum,
But I still have questions regarding multi processing.
So, in 4 multi cores computer there are four set of registers.
What about multithreading?
Supposed in 1 core processor there are 2 threads.
1. So still, there are two set of registrs but only 1, say, ALU?
2. And there is no need of pushs and pops instructions between processes unlike OS multitasking?
Thank you very much.
 
  • #6
Stephanus said:
.
What about multithreading?
Supposed in 1 core processor there are 2 threads.
1. So still, there are two set of registrs but only 1, say, ALU?
2. And there is no need of pushs and pops instructions between processes unlike OS multitasking?
Are you asking about a processor with a single core? If so, the processor has a single set of registers and a single ALU. To change from one process to another, a context switch has to happen with state for the first process saved (i.e., the state of the registers).

I haven't dug into this much lately, but I believe what I said above is accurate. If it isn't, I'm sure someone will jump in with corrections.
 
  • #7
Oh, hi @Mark44
Thanks for your answer.
I'm asking about a processor with a single core with hyperthreading facility.
So, if the processor has two sets of register there's no need to save the first process state.
I already read that
http://superuser.com/questions/122536/what-is-hyper-threading-and-how-does-it-work
It's explained there that for a processor with hyperthreading facility there are really two sets of register.
So when the processor executes long instruction like jmp, conditional jumps, loop, loopnz, call, ret, int, iret but not mul or div I think (please correct me if I'm mistaken), then there's some delay in one of its pipe, so the processor just switches to the other pipeline and executes the instructions in there. And because there are two sets of registers, there's no need for the OS to push general purpose registers. It saves time.
So, in hyperthreading the processor has 1, say, ALU but two sets of register.
And in multicores processors, each core has its own set of register.
So a processor with 5 multicores has 5 register.
For a processor with 5 multicores with hyperthreading it has 10 sets of register.
I've read all the article online but never find the definite answer about the number of register, which I have suspected.
And thanks for your other answer, but I can't respond it now. I'm still reading the links.
Thanks.
 
  • #8
Stephanus said:
...
So, in hyperthreading the processor has 1, say, ALU but two sets of register.
And in multicores processors, each core has its own set of register.
So a processor with 5 multicores has 5 register.
For a processor with 5 multicores with hyperthreading it has 10 sets of register.
I've read all the article online but never find the definite answer about the number of register, which I have suspected.
..
I think hyper-threading is a technology that mainly deals with virtual cores while multicore is termed to denote a processor with multiple physical cores. The former has a fixed number of register set in a physical core which is cloned and doubled in number when the technology is enabled (half for each virtual core). Today modern CPUs also include hyper-threading capability to power up their uses in multi-tasking applications.
 
  • Like
Likes Stephanus
  • #9
Pepper Mint said:
I think hyper-threading is a technology that mainly deals with virtual cores while multicore is termed to denote a processor with multiple physical cores.
Yes. Virtual vs physical. Or as the reference says, logical vs physical. Logical means that the OS will see that the computer has two processors.
Pepper Mint said:
The former has a fixed number of register set in a physical core which is cloned and doubled in number when the technology is enabled (half for each virtual core).
What about the latter? I read that both have doubled sets of register.
Cloned? What do you mean by cloned? The processor sets the values of both register equal? I think not.
It's not like cloned database, right?
The reason that I ask PF about this issue is that, all these years I thought that the advertisement which said that a computer had two cores or four cores was just a marketing ploy. I thought that the computer just double or quadruple the clock speed so it seemed that the computer run four times faster. Of course this can't beat a computer with a real 4 cores. No saving/loading register state. I just didn't give it much thought.
But lately my office is going to purchase some server and in its advertisement it says that it has several cores. Since it's not a $300 computer, almost ten thousands dollars, so why not dig into this matter deeper. :smile:
Thanks @Pepper Mint :smile:
 
  • #10
When your computer boots, the OS will know how many cores your processor supports so that it can run the same number of threads concurrently. So if your PC doesn't have CPU supported Hyper-Threading technology enabled in its BIOS settings, I don't think the logical core number is twice more than the physical one. Also, the assumption that one core has only one ALU I think is not true, because (1) all modern CPUs include SIMD instructions to help execute the same task at multiple data points, which speeds up the CPU's performance a lot and (2) as said earlier, ALUs of virtual cores should also be counted.
 
  • #11
Pepper Mint said:
When your computer boots, the OS will know how many cores your processor supports so that it can run the same number of threads concurrently. So if your PC doesn't have CPU supported Hyper-Threading technology enabled in its BIOS settings, I don't think the logical core number is twice more than the physical one. Also, the assumption that one core has only one ALU I think is not true, because (1) all modern CPUs include SIMD instructions to help execute the same task at multiple data points, which speeds up the CPU's performance a lot and (2) as said earlier, ALUs of virtual cores should also be counted.
Perhaps ALU is not the correct word. What I mean is this in hyperthreading case.
The difference between hyperthreading and multi core.
Hyperthreading: Only one instruction is executed at a time against one register. But there's no need to save/load register state.
Multicore: two instructions are executed against two registers. So, no need to save/load register state either.
Multitasking: Only one instruction is executed at a time against one register. But there's only 1 register, so there's a need to save/load register state between process.
 
  • #12
Each core has it's own register as well as cache. If you have multiple threads on the same core, you only have one set of registers, but it's fine because only one thread is running at a time. Splitting a process up into multiple threads on a single core doesn't make much sense unless there is a lot of IO wait.
 
  • Like
Likes Pepper Mint
  • #13
newjerseyrunner said:
Each core has it's own register as well as cache. If you have multiple threads on the same core, you only have one set of registers, but it's fine because only one thread is running at a time. Splitting a process up into multiple threads on a single core doesn't make much sense unless there is a lot of IO wait.
Yes, it can. While one core has only one register it can do multitasking, but there's a lot of pushes and pops.
For efficiency, I think each should only have two sets registers.
My theory is this.
While the core executes
- jmp
- conditional jump
- loop, loopnz
- call, ret,
- int, iret
Then there's a "long" time for the processor to wait for the next instruction. And this wait time is used for the core to execute the other instructions in another pipe.
There are two pipes in each core and there are two register. Is that so?
 
  • #14
Remember how a pipeline works, there is a lot of prediction happening. When a jmp is starting to be executed, the processor has already started executing the next couple of statements. In a conditional jump, it makes assumptions on the condition (called branch prediction) so there is actually almost no wait time in a jump for loading the next statements. Modern processors are executing like 20 commands at a time all the time. If they predict wrong, they backtrack. Something like 70% of the processor is actually dedicated to recovering in the situation when the prediction was wrong and making sure writes and reads happen in the correct order.
 
  • #15
You can also get a performance increase when one thread uses one part of the processor for example the multiply unit and the other is adding then both instructions can execute at once. You get a higher percentage of your transistors computing at the same time. This will be best taken advantage of when the OS knows about the hyper-threading capabilities.

BoB
 
  • #16
But the 1 processor can only process 1 instruction at a time. The processor has two pipeline as I read. So, the processor can only process instructions from 1 pipe at a time. But if the instruction is a long instruction that has to erase the pipe and the processor has to read the next instruction from the memory then the processor process the instructions in the other pipe, while the bus if fetching the next instruction from the pipe.
I can't imagine two threads work together to achieve a single goal.
Perhaps something like this.
10: mov AX,10; processed by thread A in processor A
20: mov BX,20; processed by thread B, in processor B. Both processes are executed simultaneously.
30: add AX,BX; processed by thread A, because line 10 and 20 can be done simultaneously. This I can't imagine.
 
  • #17
A single thread of operation is executed in one thread. So your example will be done on one thread. However each instruction is broken down into many smaller pieces on modern processors. Then they get rearranged to best use the available resources. In your three line example you might never get 10 or 20 into any register. The microcode could optimize out the intervening movement of data.

Then another thread on the same core could be doing something similar but multiply in the third line. Both the add and the multiply may be executed at the exact same time. Modern processors contain lots of frequently idle resources. MT was invented to try to use up some of that slack.

BoB
 

What is a multi-core processor?

A multi-core processor is a type of central processing unit (CPU) that contains two or more independent processing units, called cores, on a single integrated circuit. This allows the processor to perform multiple tasks simultaneously, increasing overall performance and efficiency.

How does a multi-core processor differ from a single-core processor?

A single-core processor can only execute one task at a time, while a multi-core processor can execute multiple tasks simultaneously. This makes multi-core processors more efficient and faster at completing tasks.

What is the purpose of a register in a processor?

A register is a small amount of extremely fast memory located within the processor. Its purpose is to store and hold data and instructions that the processor needs to access frequently. This helps to improve the speed and efficiency of the processor.

How do multi-core processors utilize registers?

Each core in a multi-core processor has its own dedicated set of registers. This allows each core to access and store data and instructions independently, without having to wait for other cores to finish using the registers. This helps to improve the overall performance of the processor.

What are the benefits of using a multi-core processor?

The main benefit of a multi-core processor is improved performance and efficiency. With multiple cores, the processor can handle multiple tasks simultaneously, leading to faster processing times. Additionally, multi-core processors can also help reduce power consumption and heat output compared to single-core processors, making them more energy efficient.

Similar threads

  • Computing and Technology
Replies
8
Views
1K
  • Differential Equations
Replies
1
Views
693
Replies
17
Views
4K
  • Programming and Computer Science
Replies
6
Views
3K
Replies
10
Views
2K
Replies
29
Views
4K
  • Computing and Technology
Replies
1
Views
887
  • Computing and Technology
Replies
13
Views
13K
  • Computing and Technology
2
Replies
37
Views
5K
Replies
3
Views
2K
Back
Top