Alok C
Alok C

Reputation: 2857

Can I control process priorities through perl

I am wondering if it is possible to control the priorities through perl. Basically I want my perl script to keep running in my box if some process take up the cpu. This perl script either reduce the priority or if process is too much CPU taking, perl script can kill that too. I hate to be operating System specific, But I am trying to design this for Windows system.

Upvotes: 2

Views: 865

Answers (2)

creaktive
creaktive

Reputation: 5220

From POSIX::nice():

This is similar to the C function nice() , for changing the scheduling preference of the current process. Positive arguments mean more polite process, negative values more needy process. Normal user processes can only be more polite. Returns undef on failure.

Upvotes: 0

choroba
choroba

Reputation: 241908

You can use getpriority and setpriority to handle priorities in Perl.

Upvotes: 1

Related Questions