Old Fashioned

Share this post
Interacting with Cores As A Developer
blog.virenmohindra.me
Technicals

Interacting with Cores As A Developer

Viren Mohindra
Nov 11, 2020
Share this post
Interacting with Cores As A Developer
blog.virenmohindra.me

The macOS SDK exposes a processor affinity API that you can program against. With ARM you can also selectively turn on and off cores. For example, when traveling with the work Linux laptop I turn the big cores off to drastically improve battery life. And this can be done at runtime not just at boot.

To offline a core:

echo 0 > /sys/devices/system/cpu/cpuN/online

To online a core:

echo 1 > /sys/devices/system/cpu/cpuN/online

Where cpuN is 0-4.

Keep in mind there's always one core you cannot disable to process interrupts.


  • New First
  • Chronological
© 2023 Viren Mohindra
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing