开发者

How to control process affinity in .NET 2.0?

How to control process affinity in .NET 2.0 ? I am newbie in .Net.开发者_Go百科 please help !


Please have a look at my post @How to use hardware threads in C# dot net code running on multicore machine?


In general, you do not. Sorry if that is not what you expect, but I do a LOT of server overview here and there and rarely - really rarely - see a need for that.

If you ahve to, look at the Process class - the ProcessAffinity property. But really make sure you have to in the first place.


Using the Process.ProcessorAffinity property.

// this will cause the process to run only on CPU 1
Process.ProcessorAffinity = new IntPtr(1 << 0);
// this will cause the process to run only on CPU 1+2
Process.ProcessorAffinity = new IntPtr(1 << 0 | 1 << 1);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜