How does a process "pick" which core to run on?

3

How does a program "choose" which core to run on? It was my understanding that the operating system determines which program gets processed on which core.

APPLICABLE EXAMPLE

Firefox has suddenly and rampantly been running up CPU usage on the furthest last core (i7 930 Hyperthreaded). All of the other cores are nearly usage-free.

I'm not sure why this last core is being unnecessarily picked on. I'm curious as to how it'd get singled out. Usually the first two cores handle the brunt of programs' processing.

Coldblackice

Posted 2013-04-15T08:43:20.663

Reputation: 4 774

Processes generally don't pick cores. The OS – specifically, the scheduler – decides when and where each process should run. – user1686 – 2013-04-15T08:50:45.617

Answers

5

You would be correct. The app will run on whichever core the operating system happens to choose. You can set the "affinity" for an application to a specific core, telling the OS to only run the app on that core. It's not a good idea from my understanding, but obviously it exists for a reason; so there are times it may be necessary to adjust.

In Windows you can use Task Manager:

Right click on the process, and choose "**Set Affinity**". 

As far as the technical aspects of it:

Wikipedia article on scheduling

Mira Gakatte

Posted 2013-04-15T08:43:20.663

Reputation: 86

Anecdotal notes: Adjusting affinity has done nothing but improve performance for me. Windows' scheduler does a terrible job, doing exactly what OP sees: Dumping nearly everything on one core (usually 0, in my experience, but YMMV), and thinking all is well as it struggles under the load. Additionally, managing affinities is a great way to manage heat if you have multiple apps at the same time. There are a few utilities to permanently set affinity, I've found Bitsum's Process Lasso to be lightweight and very helpful on multiple machines. https://bitsum.com/processlasso/

– Smithers – 2015-01-20T17:24:23.000