in reply to How to limit CPU utilization by ANY process with a perl script?

  1. Method 1: Replace a 3.0 GHz processor with a 2.1 GHz processor. (Adjust as appropriate!)

    Now no process can use more than 70% of the original cpu.

  2. Method 2: Write a cpu-bound monitoring process that consumes 30% of the cpu and run it at real-time priority. This works for my system, but you will probably have to adjust the constants for yours:
    #! perl -slw use strict; our $N ||= 1.75e5; while( 1 ) { Win32::Sleep 1; 1 for 1 .. $N; Win32::Sleep 1; 1 for 1 .. $N; Win32::Sleep 1; 1 for 1 .. $N; }

Question: Why do you want to limit processes to no more that 70% CPU?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re: How to limit CPU utilization by ANY process with a perl script?
  • Download Code