Realtime scheduling??

Paul Winkler slinkp23 at yahoo.com
Fri Jan 21 01:12:16 EST 2000


Erno Kuusela wrote:
> 
> >>>>> "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.

I _am_ using stock sound drivers (OSS/ Linux) ... that's how I get
messages to MIDI devices.
Maybe you misunderstood. I'm not writing a software synthesizer. I'm
using other people's synth software, principally csound. Csound can
read realtime events sent as text through a pipe, it's fun and easy
to do. My code simply generates events for controlling other
synthesizers, whether hardware synths via MIDI or soft-synths via
pipes or whatever.
 
>     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.

BUT, for all intents and purposes, it CAN be with a patched 2.2
kernel.  Some people have demonstrated that linux can reliably
_beat_ the realtime performance of BeOS which is supposed to be the
best commercial OS for realtime multimedia work.
But you need 2.2 and some patches to it, and you need your C program
to be run SCHED_FIFO, and I don't know quite what that means or how
to make python do it, or even if it can.

> 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.

Do you have any examples of doing this with python? I'm searching
the python website for "real-time" and find nothing but rtlinux
stuff...
thanks!
 
>     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".

That's intriguing... I found some links... looks like this also
needs kernel 2.2, so it's REALLY time for an upgrade here.
 
Thanks for the reply!

................    paul winkler    ..................
slinkP arts:   music, sound, illustration, design, etc.
A member of ARMS    ----->    http://www.reacharms.com
or http://www.mp3.com/arms or http://www.amp3.net/arms
personal page   ---->    http://www.ulster.net/~abigoo



More information about the Python-list mailing list