After doing some tests, I got the results as below:
echo 0 > /sys/devices/system/cpu/cpu4/online
echo 0 > /sys/devices/system/cpu/cpu4/online
does disable the 4th CPU.
"disable
"disable the 4th CPU" means that the later processes won't be assigned to the 4th CPU anymore. In other words, the processes located at the 4th CPU before "disable the 4th CPU" won't be moved out from the CPU while disabling the CPU.
Saying that I have four CPUs: 0, 1, 2 and 3. So I can
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu3/online
./MyShell.sh
to:
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu3/online
./MyShell.sh
to force the ./MyShell.sh to be assigned to the CPU0.
By the way, reboot will enable all CPUs automatically.