Passing In PIDs and Priorities
If you want to use priority.pl to discover a process's current priority class, run the following command on the local system:
perl priority.pl PID
where PID is the process's PID (e.g., 532). To query more than one process, pass in multiple PIDS separated by a space, as in
perl priority.pl 532 1112 8832
To set a new priority for the specified PID, add the -s option and the priority class:
perl priority.pl -s low PID
To set the priority for more than one process, pass in multiple PIDS, separated by a space. For example, the command
perl priority.pl -s low 532 1112 8832
sets the Low priority class for the processes that have PIDs 532, 1112, and 8832. You can specify only one class, which will go into effect for all the specified PIDs.
Rule Your Scripts
While writing this column, I used priority.pl to tame some mischievous processes. I was using Microsoft Windows Media Encoder to encode a video into Microsoft Windows Media Format, and the process was taking up too much CPU time. After I ran priority.pl and passed in the -s low parameter and the offending application's PID, the encoder slid into the background, where it no longer affected my work. . . .