How to limit CPU usage of a process
<p>I want to create a program wich can limit cpu usage of a process even when the computer is idle..
I have made a program that set priority of process, but if the computer is idle, the cpu usage can reach 95%.
The process contains "element" is the process that I want to limit</p>

<pre><code>    private static readonly string[] RestrictedProcess = new[] { "element" }; 
    static void ProcessChecker(object o)
    {
        List&lt;Process&gt; resProc = new List&lt;Process&gt;();
        foreach(Process p in Process.GetProcesses())
        {
            string s = p.ProcessName;
            foreach(string rp in RestrictedProcess)
            {
                s = s.ToLower();
                if (s.Contains(rp))
                    resProc.Add(p);
            }
        }

        foreach(Process p in resProc)
        {
            p.PriorityBoostEnabled = false;
            p.PriorityClass = ProcessPriorityClass.Idle;
            p.MaxWorkingSet = new IntPtr(20000000);
        }

        SetPowerConfig(resProc.Count &gt; 0 ? PowerOption.GreenComputing : PowerOption.Balanced);
    }
</code></pre>

<p>thanks in advance...</p>
