c# - how to set CPU affinity of a program? -


I have written a program in C #, I developed a Windows VSTS 2008 + .NET 3.5 + Windows I am using Vista Enterprise x86. Application of the form.

My current computer is a dual-core CPU, I want to run my program's CPU affinity on a specific CPU and release another CPU for another job. Any ideas how to do this? Either the coding or configuration is fine.

There is a bit more background, my program is CPU intensive, so I do not want to capture all the two CPU resources on my computer and I want to free a CPU so that I can connect to the network at the same time Quickly browse : -)

Thanks in advance, George

  1. strong> work Manager -> Processes tab.
  2. Find your program.
  3. Select Set affinity and uncheck one of the checkboxes.

This should free a processor for you.

You can add this statement to do this by code:

  System.Diagnostics.Process.GetCurrentProcess (). ProcessorFactory = (System.IntPtr) 1;  

Cheers!


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -