LinuxRealTime - Perl extension for setting real time priority
use LinuxRealTime; LinuxRealTime::setRealTime(10); # freeze the computer for a while my $j; my $i; foreach $j (0..30_000_000) { $i = sqrt ($j); }
Calling LinuxRealTime::setRealTime(10) sets the scheduling method of the current task to SCHED_FIFO with a priority of 10 (if the script is executed by root). The parameter specifies the priority, so different scripts can run with different priorities.
SCHED_FIFO is used to build real time applications. The linux kernel (>= 2.6) schedules all tasks using SCHED_FIFO _before_ any other "interactive task". Therefore all CPU resources are then used by the Perl skript.
This can be used to meassure execution times or to build real time applications.
!!!!! BE CAREFULL !!!!! Be CAREFULL with scripts that have long execution times. Once started as root, you will not even be able to send a CTRL-C to your script as the shell or X won't get any CPU ressources.
None by default.
Daniel Zinn, <perl-public@qmic.de<gt>
Copyright (C) 2005 by Daniel Zinn
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install LinuxRealTime, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LinuxRealTime
CPAN shell
perl -MCPAN -e shell install LinuxRealTime
For more information on module installation, please visit the detailed CPAN module installation guide.