in reply to Configurable CPU/Memory Use Script

Just do a mix of spinwait and sleep(). Note that you will have to finetune what the ratio should be. Also in the while(1) you should put the logic to decide when the program should wake up.

Seems like a pretty big waste of CPU though. Might there be a way of running the process with a higher priority?

$sec = 0; while(1) { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime( +time); if($sec%2==0) { sleep(1); } }