in reply to Re: Re: use less 'CPU'
in thread use less 'CPU'

What is wrong with using "nice" to lower the priority of the long-running process? That way the process gets to use all of the CPU when there is nothing else running but doesn't slow down normal processes. The operating system handles the scheduling efficiently. No polling, busy loops, or extra signals required.

Replies are listed 'Best First'.
Re: Re: Re: Re: use less 'CPU'
by powerman (Friar) on Feb 14, 2003 at 22:50 UTC
    1. This process will take 100% CPU until other process, also very greedy to CPU will execute. Most system administrators, especially web hosting ones, dislike processes take 100% CPU, no matter they use "nice" or not.
    2. Code sometimes contain bugs. Sometimes bug initiate an infinite loop which only take CPU and do nothing. This slow down overall system very much and this slowdown can be detected many time after: for example, some time ago I execute such script in background and log out from system, and then log in after 10 hours (because I estimate time to finish this script to 10 hours) and found very slow system and a lot of complains from customers "why system was too slow yesterday?". My solution allow to limit maximum CPU load and no bug can break this limit.
    3. It's nice to have ability to control how greedy for CPU your script can be. It's nice to have simple way to control speed of your script. And it was very interesting to develop this solution!