Hey guys,
I just wanted to share a couple of cool utilities to assist with managing processes.
ImageCFG (http://www.robpol86.com/index.php/ImageCFG)
ImageCFG is a utility that lets you tweak the CPU affinity of an executable. What does this mean? Well, if you have a multi-core system, or even a hyper-threaded (virtual multi-core) system, you can restrict which cores a process can execute on. This may be desirable if there is a program that tends to hog processor time, such as a video editing application, and you want to allow it to run, but only on a restricted set of resources.
Prio (http://www.prnwatch.com/prio.html)
Although I haven’t used Prio yet, it looks to be a great, free (for personal use) program. A couple of features it offers are:
- Save process priority settings – useful if there’s a program you always want to run in low priority / background mode
- Always elevate certain processes – maintain good security with UAC, and convenience at the same time!
- TCP / IP task manager tab – lets you view open network connections in real-time through task manager
——————————————
I had a need for a piece of the Prio tool, but didn’t need the entire toolset (or be able to use it freely for commercial use), so I wrote a small C# utility called “SetProcessPriority” that does just what I need it to, instead. This utility searches for a process by it’s friendly name (eg. ‘notepad‘, but without the ‘.exe’) every 2 seconds, and sets the process’ priority to “Below Normal.” This was necessary to server as a work-around to a software bug I was having with the Microsoft ConfigMgr console.
Here is the C# code for it:
using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
namespace SetProcessPriority
{
class Program
{
static void Main(string[] args)
{
if (args.Length != 1) return;
string procname = args[0];
while (1 == 1)
{
try
{
Process[] procs = Process.GetProcessesByName(procname);
foreach (Process proc in procs)
{
proc.PriorityClass = ProcessPriorityClass.BelowNormal;
}
}
catch { }
Thread.Sleep(2000);
}
}
}
}
You can compile the above code in Visual Studio 2008, targeting the .NET 2.0 framework. Once you’ve compiled it into a .NET assembly, you can simply write a batch script to call it, like this:
SetProcessPriority notepad
———————————————-
Anyway, I hope this post helps someone out, out there!
Merry Christmas to all!