Re: [linux-audio-dev] real time priority programming tutorial

From: Christian Schoenebeck <cuse@email-addr-hidden>
Date: Mon Jun 05 2006 - 19:38:19 EEST

Am Montag, 5. Juni 2006 16:12 schrieb Steve:
> Here is essentially the code I have been using for this purpose.
> You don't necessarily need to use max priority for sp.sched_priority.
> There may be better ways of doing this, I guess... if anyone sees if
> I'm missing something. Seems to work, but has the disadvantage of
> having to run under "sudo" to gain the priority.

Depends on your system configuration. I don't have to call it as super user on
my system.

> I'm not 100% sure if the mlockall call is necessary.

mlockall avoids memory swapping, so as long as you haven't completely turned
off swapping in your system it's definitely a good idea to call mlockall in a
RT sensitive process.

If you're not a C++ hater, here's a general purpose "Thread" class which can
be used for RT threads and low priority threads as well:

http://cvs.linuxsampler.org/cgi-bin/viewcvs.cgi/linuxsampler/src/common/Thread.h
http://cvs.linuxsampler.org/cgi-bin/viewcvs.cgi/linuxsampler/src/common/Thread.cpp

Just derive from that abstract "Thread" class and implement the virtual
method "int Main()" in your class.

CU
Christian
Received on Mon Jun 5 20:15:01 2006

This archive was generated by hypermail 2.1.8 : Mon Jun 05 2006 - 20:15:02 EEST