- Sep 19, 2000
- 10,284
- 138
- 106
So, I've become interested in ASM programming recently, and had this question that has been nagging at me. How does the operating system tell the processor which core to run code on? I know it has to be done at the OS level, and it has to be some sort of specific assembly instruction, but I can't find anywhere anything more then an explanation of how threading works (and that isn't how threading works on different cores either).
My thoughts are that each core has its own interrupt timer with some sort of signaling method to tell the OS which core it is that sent the interrupt. The OS receives the interrupt like normal and returns, like normal, only somehow the iret instruction has been tweaked to go to the core that called the interrupt rather then some other core.
I know there has to be some communication going on to tell which core is which. Otherwise you couldn't set processor affinity in the OS.
So is it really just scheduling certain tasks for certain processors?
My thoughts are that each core has its own interrupt timer with some sort of signaling method to tell the OS which core it is that sent the interrupt. The OS receives the interrupt like normal and returns, like normal, only somehow the iret instruction has been tweaked to go to the core that called the interrupt rather then some other core.
I know there has to be some communication going on to tell which core is which. Otherwise you couldn't set processor affinity in the OS.
So is it really just scheduling certain tasks for certain processors?