Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux啟用多核心(SMP)支援:安裝kernel-smp套件

編輯:Linux 教學

早期Red Hat Enterprise Linux 4 / CentOS 4預設安裝單核心核心,多CPU/多核心機器需手動安裝kernel-smp套件並配置啟動載入器。現代發佈版核心已內建SMP支援,本文供歷史版本維護參考。

適用環境

  • RHEL 4 / CentOS 4 / Fedora Core 3 等 2.6 核心早期版本。
  • 物理機器擁有多顆CPU或多核心CPU(cat /proc/cpuinfo 顯示 processor > 0)。

操作步驟

  1. 以root登入文字模式(init 3)。
  2. 安裝SMP核心套件:
    rpm -ivh kernel-smp-2.6.9-42.EL.i686.rpm
    # 或 yum install kernel-smp
    
  3. 建立initrd映像:
    mkinitrd -f /boot/initrd-2.6.9-42.ELsmp.img 2.6.9-42.ELsmp
    
  4. 配置GRUB/LILO(以GRUB為例,編輯/boot/grub/grub.conf):
    title Red Hat Enterprise Linux ES (2.6.9-42.ELsmp)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.9-42.ELsmp ro root=/dev/sda2
        initrd /boot/initrd-2.6.9-42.ELsmp.img
    
  5. 重啟並選擇SMP核心啟動:GRUB選單選上述項目,或設為default=0。
  6. 驗證:
    uname -r           # 應含 smp 字樣
    cat /proc/cpuinfo  # 顯示多個 processor 項目
    top                # 按 1 顯示每個 CPU 使用率
    

現代發佈版簡化

  • RHEL 5+ / CentOS 5+ / Fedora 10+ / Ubuntu 8.04+ / Debian 5+:預設核心即支援SMP,無需額外套件。
  • uname -r 不再出現 smp 後綴,但 CONFIG_SMP=y 已編譯進核心。
  • 虛擬機環境:確保 Hypervisor 分配多 vCPU,客體核心自動識別。

效能調優提示

  • IRQ平衡:systemctl enable --now irqbalance 自動分發中斷至多核心。
  • CPU頻率調度:cpupower frequency-set -g performance(高效能負載)或 ondemand(預設)。
  • NUMA系統:numactl --interleave=all 運行記憶體密集型應用。

SMP支援已成Linux核心標準配置,歷史手動安裝流程見證了多核心時代的到來。

Copyright © Windows教程網 All Rights Reserved