Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CPU Affinity on the Mac 10.6+ and Xcode 4+

Tags:

xcode

macos

Not sure if this is the right place to post this question but here it is anyway.

I remember back in the days with Xcode 3.x, there was a prefPane that once installed, it would allow you to turn on and off of your CPU cores. This was removed in Xcode 4. I was just wondering if there are any utilities in OS X >= 10.6 that will accomplish a similar feat or at least be able to just type a command and assign a process to a CPU core?

like image 840
Y.H Wong Avatar asked Aug 05 '11 02:08

Y.H Wong


People also ask

Does CPU affinity affect performance?

The first benefit of CPU affinity is optimizing cache performance. The second benefit of CPU affinity is if multiple threads are accessing the same data, it makes sense to run them all on the same processor—helping us minimize cache misses.

Is setting processor affinity useful?

Setting affinity does do something, but you'll never want to use it. Setting the CPU affinity forces Windows to only use the CPU (or cores) selected. If you set the affinity to a single CPU, Windows will only run that application on that CPU, never on any others.

What is meant by CPU affinity?

Processor affinity or CPU pinning enables applications to bind or unbind a process or a thread to a specific core or to a range of cores or CPUs. The operating system ensures that a given thread executes only on the assigned core(s) or CPU(s) each time it is scheduled, if it was pinned to a core.


1 Answers

I believe the processor pane is still there but needs to be installed.

it should be at /Developer/Extras/PreferencePanes/

Alternatively you can set the processor control in NVRAM but this requires a reboot

as follows

     $ sudo nvram boot-args="cpus=1"

more details at the docs link

A third option may be the CPUPalete app. If this is on your system you can find it

/Library/Application Support/HWPrefs/CPUPalette.app

Apple's docs are here Apple CPU control

like image 117
stimpy Avatar answered Oct 02 '22 19:10

stimpy