I have a cgi script that is kind of a cpu hog. Some of the people using it are my students, and I want to make sure it's fast for them. Other people using it are people I don't know, and I'd like them to get a smaller share of CPU time.
I can do this:
use POSIX ();
if ($not_my_student) {
POSIX::nice(17);
}
What worries me a little is that the nice() function behaves cumulatively. To make the whole thing really bulletproof and portable, I'd like to be able to figure out what my process's current priority is, and make sure that I never nice it down to such a low priority that it starves for CPU, or gets terminated (which I believe can happen on at least some Unixes if your priority is low enough). I don't want to make any assumptions, for instance, about what basic priority Apache is running at.
I can't seem to find anything in the POSIX module that lets me find out my current priority. Is there any way to do this without crufty platform-specific calls to external scripts?
TIA!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |