Number of available cores To find the number of cores available to you in Termux you run:

grep Cpus_allowed /proc/self/status


This number of cores is limited in a similar way to running taskset on GNU/Linux.

I am trying to be able to predict what that will return.

According to the app CPU-Z my phone (Huawei Smart P) has 1 HiSilicon Kirin 659 with 8 cores. According to the app CPU Info 4 cores are running the same speed (480-1709Mhz) and 4 cores are running the same speed (1402-2362Mhz).

After booting the phone and waiting 5 minutes to make sure all startup tasks have been started/completed I started Termux, login through ssh and got:

Cpus_allowed_list:       0-7


Which is exactly what I expect.

But if I press the home key, I get:

Cpus_allowed_list:      2-3


I thought this might have to do with how hard the cores are loaded, so I switched to Termux again, started 16 bzip2s. This does not change the number of cores I get immediately. But after 30s I get 4 cores:

Cpus_allowed_list:     0-3


And yet later I get bumped back to 2 cores:

Cpus_allowed_list:      2-3


This behaviour happens through ssh whether Termux is in the foreground or background.

The effect of the home key is only when running Termux: If I run CPU Info, then press home and then start Termux, then Termux still has 8 cores:

Cpus_allowed_list:       0-7


Only when I switch away from Termux using the home key, the app-list key, or the back key does the number of CPUs change.

Software controlled big.LITTLE could explain going from 8 to 4 cores if the limit was not enforced immediately after boot, but only activated later. Since the limit is not activated 5 minutes after boot, I think it is safe to reject this as the explanation. Also it does not explain limiting to 2 cores some of the time when running 16 bzip2s.

What is causing the phone to limit me from using 8 cores? How can I tell the phone not to do so? What is causing the limit to jump between 2 and 4 cores at seemingly random intervals?

(On top of this I had expected the cores to run at 100% speed which also does not happen).

The limitation does not happen if not run through ssh or if run in a tmux session where the tmux session is started.
Summary: the more cores you use the more battery you consume so CPU hotplugging turns off the other cores, and the others do the work which makes them at 100% CPU usage, which also give the best performance and the most balanced one.

It's CPU hotplug It turns on and off the cores when needed or not.

It's running 100% CPU usage because it's like this. Imagine, there's a 4 car, and let's assume the drivers are the cores. You have four lanes and 4 cars of course. Each one of them will take 100 pizzas. You can let one  core to do all the work and that's what hot plugging do. Knowing that a car with 50 pizzas consumes a lot less fuel than a car with 100 pizzas you can now see how we can have the same performance and save on fuel: load two cars with 50 pizzas and let them accelerate as quickly as possible to the destination (performance governor). They will get there as quickly as one car with 100 pizzas (same performance), but burn less fuel (battery saving).

If you want to make your phone run at 8 cores then you need to install a custom kernel, use an other CPU governor, use a custom CPU hotplugging, or without installing a custom kernel use an interactive governor, then tweak its parameters.
You can search on XDA for Advance Interactive governor tweaks.