PDA

View Full Version : How to lessen script load?


RandomLove
Sat 29th May '04, 9:41am
Hi,
I have a script that do some computation and disk i/o. I don't want the script to take all of the system resources.

I think there are two ways to do it:
1- Make the script wait or become idle at cerain server load.
2- Make it sleep after x amount of computations cycles.

How do I do both?

Thanks.
R.L. :)

Shining Arcanine
Sat 29th May '04, 1:31pm
This really is the field of a computer program...

Anyway, you could look into better programming techniques or space out the crons.

RandomLove
Sat 29th May '04, 3:15pm
You mean a compiled program?

Shining Arcanine
Sat 29th May '04, 7:11pm
You mean a compiled program?
Yes.

rnawky
Sat 29th May '04, 10:46pm
er, then why did you post in php coding

sirspot
Mon 31st May '04, 3:15pm
Although this is not a PHP question. I have used the following with PHP scripts to allow them to interact "nicely" with the operating system when running in a semi-infinite loop.

Unix/Linux:

Use the nice commans:
nice [OPTION] [COMMAND [ARG]...]

Windows:

Set the process priority:
go to task manager
select processes tab
right click your process
select desired priority