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


version 0.003


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


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.



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


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

sched_setpriority($pid, $priority)

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


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


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.


Leon Timmermans <>


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.