Realtime scheduling??

Erno Kuusela erno at iki.fi
Wed Jan 19 19:49:08 EST 2000


>>>>> "paul" == Paul Winkler <slinkp23 at yahoo.com> writes:

    paul> Hi, I'm working on a module I eventually hope to use to
    paul> generate musical events in realtime. (These events will be
    paul> sent to MIDI devices or to software synthesizers.)

i think there is some midi support in the stock sound drivers.
you might be better off using that.

    paul> I've found that on my Linux system (pretty much stock RedHat
    paul> 5.2), scheduling actions with sched.scheduler is not as
    paul> reliable as I'd like. Events are anywhere from 2 to 20
    paul> milliseconds late.

yeah, linux is not a real-time operating system. using a "real-time"
scheduling class might, or might not, help. they are mostly a way to
tell the scheduler to choose your task over other tasks when it's time
to switch.

    paul> I'd like to improve the reliability, which brings me to my
    paul> next question:

    paul> Is there any way to run a python script, or rather the
    paul> python interpreter itself, with SCHED_FIFO priority on a
    paul> linux system?  Or any other way to guarantee that something
    paul> will happen when you really want it to happen??

there are programs that work like nice(1), one is named rtnice. a web
search should find it for you. then you can say
"rtnice python myprogram.py".

  -- erno



More information about the Python-list mailing list