The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

POSIX::RT::Scheduler - POSIX Scheduler support functions

VERSION

version 0.002

SYNOPSIS

 sched_setscheduler($pid, 'rr', 10);

DESCRIPTION

This module allows one to set the scheduler and the scheduler priority of processes.

The following scheduler policies are supported:

  • other

    This is the default non-real-time scheduler. It doesn't have a real-time priority

  • fifo

    This is a real-time scheduler. A fifo scheduled process runs until either it is blocked by an I/O request, it is preempted by a higher priority process, or it calls sched_yield.

  • rr

    Round-robin scheduling. This is similar to fifo scheduling, except that after a specified amount of time the thread will be

  • batch

    A Linux specific scheduler, useful for keeping CPU-intensive processes at normal priority without sacrificing interactivity.

  • idle

    A Linux specific scheduler that causes a process to be scheduled only when there's no other (non-idle scheduled) process available for running.

FUNCTIONS

sched_getscheduler($pid)

Get the scheduler for $pid.

sched_setscheduler($pid, $policy, $priority = 0)

Set the scheduler for $pid to $policy, with priority $priority if applicable. $priority must be within the inclusive priority range for the scheduling policy specified by policy. If $pid is zero, the current process is retrieved

sched_getpriority($pid)

Return the real-time priority of $pid as an integer value.

sched_setpriority($pid, $priority)

Set the real-time priority of $pid to $priority.

sched_priority_range($policy)

This function returns the (inclusive) minimal and maximal values allowed for $policy.

sched_yield()

Yield execution to the next waiting process or thread. Note that if the current process/thread is the highest priority runnable real-time scheduled process/thread available, this will be a no-op.

AUTHOR

Leon Timmermans <leont@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.