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

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

我有一台 Acer Aspire One D270 上网本

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

由于 Ubuntu 12.04 检测到 4 个 CPU,因此我遇到了过热问题。您知道如何解决这个问题吗?

答案1

Ubuntu 只是检测到了这两个逻辑核心由于英特尔的超线程技术。

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

如果您无法从 BIOS 设置中禁用 HT,您可以在操作系统内部通过创建脚本并在计算机启动时运行该脚本来禁用 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

将其复制到 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

3.设置开机运行的脚本:
Alt+F2并输入gksudo gedit /etc/rc.local
使此文件看起来像这样:

#!/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

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

答案2

笔记本电脑没有过热,因为您的计算机检测到 4 个 CPU。检测到 4 个 CPU 是正常的,您的双核 CPU 具有超线程,这意味着 CPU 可以在 2 个并行线程上处理指令,因此每个核心都像两个一样运行(尽管实际速度增益不是两倍)。

笔记本电脑过热是因为某些组件使用过度(显卡、CPU),这可能是因为您使用的是库存驱动程序,而其中一个不是理想的驱动程序。

我的台式机也遇到过类似的问题,在 Ubuntu 16.04 中,我的显卡被限制到最大速度,直到我更换了原装驱动程序并安装了正确的 nVidia 驱动程序。
在 Windows 7 中,您不会遇到此问题,因为它有/曾经有正确的驱动程序。

相关内容