[英]Strange ProcessorAffinity issue with IEXPLORE.exe
I need to launch IE and set the affinity to a particular single CPU. 我需要启动IE并将亲和力设置为特定的单个CPU。 When running the following c# code, as expected notepad.exe is started and has it's affinity set to just cpu2, strangely iexplore.exe is started with its affinity set to just cpu0.
运行以下c#代码时,按预期方式启动notepad.exe并将其亲和性设置为cpu2,奇怪的是,启动iexplore.exe时其亲和性设置为cpu0。 No matter what I set ProcessorAffinity to iexplore.exe always goes to cpu0.
无论我将ProcessorAffinity设置为iexplore.exe为何,总会进入cpu0。
I have tested this on 4 core xp 32 bit and 4 core 2008 64 bit, both IE8. 我已经在IE8的4核xp 32位和4核2008 64位上对此进行了测试。
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
}
}
I have tested your program and it works fine for me. 我已经测试了您的程序,对我来说效果很好。 I even checked in the task manager and the affinity of
iexplore.exe
is set to CPU 2. 我什至在任务管理器中签入,并将
iexplore.exe
的相似性设置为CPU 2。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.