3
$\begingroup$

When running a single-threaded application that is 'always busy', on a multi-core computer, modern operating systems will typically switch the process from one core to another from time to time. Even when the other cores are always idle.

Typically you can see 1 of 4 cores on a quad core processor at 100% load while the other cores are 0-1%. Once in a while, the active process will 'jump' to another core, now leaving the original core idle and utilizing 100% of another core.

Why does this happen?

Is it because the process was context-switched (even though other cores were idling)? Or is it because of thermal or power-related reasons? Something else?

$\endgroup$

2 Answers 2

2
$\begingroup$

Multitasking works like this: allow user process to execute for a little, then switch back to OS scheduler to be able to execute something else.

In multicore architectures, every core has equal opportuninty to acquire the process.

If you want to force your process execution on the selected core, this selection must be stored somewhere. There’s usually no reason to do that.

$\endgroup$
2
$\begingroup$

Improving thermal problems is a good reason. Processor speed is limited by heat. By switching to another and cooler core, the new core can run at a higher clock speed.

PS. Quite possible that this happened by coincidence in the first scheduler, the happy side effect was detected, and then they kept it. You could verify this on a processor with hyper threading: If you have four cores with hyperthreading = 8 virtual cores, it would be pointless to switch to a different virtual core on the same real core to keep heat down.

$\endgroup$
1
  • $\begingroup$ Do you know if this is actually considered during process scheduling? Or is it just a lucky side-effect of how process scheduling arbitrarily assigns processes to cores? $\endgroup$ Oct 18, 2018 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.