Hello!

I'm having a problem with my php script on my linux web server. In that
script there is a cycle with some math calculations (about ~30 steps), the
execution time is less 1 second, but the script loads the server CPU up to
90%...
I've optimized script already to the minimum math function, anyway, it still
overloads the CPU.
How can I reduce the CPU load? It seems that usleep() does not help much,
especially in Windows (it's not supported).
How can I give system a portion of time in the end of each step (I don't
mind if it will increase the job time)? Is there a solution for both Windows
and Linux?

For instance, in C++ under Windows I would do this:

do
{
    [... math calculations ...]
    while(::PeekMessage(&message,NULL,0,0,PM_NOREMOVE))
        if (!theApp.PumpMessage()) break;
} while(!quit);

This gives system to redraw screen, process any other events during long
cycles...
Is there similar approach in PHP for web server programming?

p.s. Would be nice to know other techniques to reduce CPU load ;)

Thank you!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to