Ubuntu 检测到 4 个 CPU 而我只有 2 个 CPU?

Ira*_*Rmz 2 cpu

我有一台 Acer Aspire One D270 上网本

  • 2GB 内存
  • 320GB 硬盘
  • 英特尔凌动 N2600 1.6 Ghz(2 核)

我有过热问题,因为 Ubuntu 12.04 检测到 4 个 CPU。你知道如何解决这个问题吗?

Mar*_*kal 5

由于英特尔的超线程技术,Ubuntu 只是检测原子芯片公开的每个物理内核的两个逻辑内核

禁用此功能的最佳方法是通过 BIOS 设置,当您的计算机制造商的徽标在启动时显示时按F1/ F2/ F10(或您机器的特定键,如果不同)并从那里禁用它。在我的上网本上,超线程位于 BIOS 设置的“高级”页面上。现在只有两个内核可供操作系统使用。

如果您无法从 BIOS 设置中禁用 HT,您可以通过创建脚本并在计算机启动时运行它来从操作系统内部执行此操作。

1. 创建脚本:
我得到了我们将在这里使用的脚本我也会在下面添加它,这样您就不需要在两个浏览器选项卡之间移动。

#!/bin/bash

# Be careful to not skip the space at the beginning nor the end
CPUS_TO_SKIP=" $(cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list | cut -d '-' -f 1 | sort | uniq | tr "\r\n" "  ") "


for CPU_PATH in /sys/devices/system/cpu/cpu[0-9]*; do
    CPU="$(echo $CPU_PATH | tr -cd "0-9")"
    echo "$CPUS_TO_SKIP" | grep " $CPU " > /dev/null
    if [ $? -ne 0 ]; then
        echo 0 > $CPU_PATH/online
    fi
done
Run Code Online (Sandbox Code Playgroud)

将其复制到 gedit 并将其另存为disable_ht.sh.

2. 安装脚本:
Ctrl+ Alt+打开终端,T然后使用 导航到之前保存脚本的位置cd $location。现在对您保存的文件运行以下命令:

sudo cp disable_ht.sh /usr/local/bin
sudo chmod +x /usr/local/bin/disable_ht.sh
Run Code Online (Sandbox Code Playgroud)

3. 将脚本设置为在启动时运行:
点击Alt+F2并输入gksudo gedit /etc/rc.local
Make this file like this one:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#
# Add this line right above the 'exit':
/usr/local/bin/disable_ht.sh
exit 0
Run Code Online (Sandbox Code Playgroud)

单击保存并退出,现在当您将计算机启动到 ubuntu 时,超线程将被禁用。