Skip to main content
deleted 12 characters in body
Source Link
Vlastimil Burián
  • 31.1k
  • 66
  • 209
  • 358

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.

After doing some tests, I got the results as below:
echo 0 > /sys/devices/system/cpu/cpu4/online does disable the 4th CPU.
"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 force the ./MyShell.sh to be assigned to the CPU0.
 

By the way, reboot will enable all CPUs automatically.

After doing some tests, I got the results as below:

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

does disable the 4th CPU.

"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 force the ./MyShell.sh to be assigned to the CPU0.

By the way, reboot will enable all CPUs automatically.

Source Link
Yves
  • 3.4k
  • 8
  • 38
  • 66

After doing some tests, I got the results as below:
echo 0 > /sys/devices/system/cpu/cpu4/online does disable the 4th CPU.
"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 force the ./MyShell.sh to be assigned to the CPU0.

By the way, reboot will enable all CPUs automatically.