wanna restrict the cpu usage for my own script
Moderator: General Moderators
-
AngryProphet
- Forum Newbie
- Posts: 2
- Joined: Tue Sep 05, 2006 7:06 am
wanna restrict the cpu usage for my own script
Our database transfer script puts the cpu usage on the server (xampp on Win2000) to 95%. This script may run in background. What I want is, that the script pauses so that the server stays available for other users. I tried with usleep(30) but the result is not very impressing. Does anybody solved a similar problem with a proper solution?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
usleep(30) is a sleep of 30 microseconds. Hardly enough time for the OS to take any amount of clock back before being interupted. I'd increase the amount you pass to it be a LOT. There's always sleep() too.
-
AngryProphet
- Forum Newbie
- Posts: 2
- Joined: Tue Sep 05, 2006 7:06 am