奇怪的处理器与 IEXPLORE.exe 的关联性问题

本文关键字:exe 关联性 IEXPLORE 问题 处理器 | 更新日期: 2023-09-27 18:33:44

我需要启动IE并设置与特定单个CPU的关联。当运行以下 c# 代码时,正如预期的那样.exe记事本启动并使其关联性设置为仅 cpu2,奇怪的是 iexplore.exe 启动时其相关性设置为仅 cpu0。 无论我将 ProcessorAffinity 设置为 iexplore.exe 总是转到 cpu0。

我已经在 4 核 xp 32 位和 4 核 2008 64 位上对此进行了测试,两者都是 IE8。

using System;
using System.Diagnostics;
public class Launch
{
    public static void Main(string[] args)
    {
        lauchWithAffinity("c:/windows/system32/notepad.exe");
        lauchWithAffinity("c:/Program Files/Internet Explorer/IEXPLORE.EXE");
    }
    static void lauchWithAffinity(string exePath)
    {
        ProcessStartInfo start = new ProcessStartInfo();
        start.FileName = exePath;
        Process myProcess =Process.Start(start);
        myProcess.ProcessorAffinity = (System.IntPtr)4; //3rd cpu aka cpu2 
        //http://msdn.microsoft.com/en-us/library/system.diagnostics.process.processoraffinity.aspx
    }
}

奇怪的处理器与 IEXPLORE.exe 的关联性问题

我已经测试了您的程序,它对我来说效果很好。我什至检查了任务管理器,iexplore.exe的亲和力设置为 CPU 2。