As part of resurrecting my MacBook Pro and making it usable, one of the things I have been try is to control how many CPUs are active at a given time. I could have just disabled HyperThreading to halve the CPUs. But was curious how can I go about doing it in general.
As with all things in Linux, CPUs are represented as files. The act of disabling turbo-boost was one such example.
This time the command is lscpu
. It is a fairly versatile command with many options. lscpu -h
should print all the options and help, while just lscpu
will print just the basic information about the CPU(s) in machine.
However it can list all CPUs online/offline with extended information, that what is printed here:
|
|
This MBP has just 1 chip, 4 Core & 8 Threads- thus 8 logical processors. Core column repeats from 0-3. Here I am just switching off 1 Logical Processor from each core by writing 0
in each CPU file. Well this is equivalent to switching off HyperThreading, but to conserve battery one could have just switched off entire cores. Perhaps more on this later with powertop
.
|
|
After this, said CPUs will be taken offline, ONLINE
column has no
for such CPUs.
|
|
There are other ways to check which CPUs are online & offline:
|
|