[Asterisk-Dev] Hard real-time?
Steve Kann
stevek at stevek.com
Thu May 12 17:24:19 MST 2005
Ricardo Poppi wrote:
> Ricardo Poppi wrote:
>
>
>>> Hi all! There are some linux kernel projecs that provides hardware
>>> real-time kernel for real time applications. I´ve been looking
>>> around about RTLinux and RTAI. Those hard real-time kernel
>>> implementations provides a hardware abstraction layer where the
>>> regular linux kernel is executed as a low priority task. But - now
>>> comes the candy - all the real time applications are executed by
>>> this HAL as high priority so it should guarantee the real time
>>> responses needed.
>>>
>>> But - now comes the issue - the "real-time application" needs to be
>>> written using those "new" cappabilities. Take a short look at this
>>> sentence about RTLinux programing impact: "...From the application
>>> programmers point of view, the queues look very much like standard
>>> UNIX character devices, accessed via POSIX read/write/open/ioctl
>>> system calls. Shared memory is currently accessed via the POSIX mmap
>>> calls..."
>>>
>>> Do anybody knows about a hard real-time asterisk dev
>>> project/prototype/beta going on?
>>
>>
>>
>
> I think that getting proper soft-real-time support to work more sanely
> would be a much simpler first step (more "bang for the buck",
> so-to-speak).
>
> I have patches which implement the ideas in a mantis bug about this,
> and I'll be putting them up soon. Basically, they'll allow you to,
> safely, run asterisk as real-time under linux.
>
> -SteveK
>
>
>
> Nice SteveK! Actually I´m just looking around about QLinux and Ingo´s
> patch for kernel.
>
> The main issue about it - I did not tested yet, probably I will do
> until weekend time - is that
> QLinux, for example, just runs in 2.4.x kernel and I got affraid that
> this environment could lack
> some important resource - or bug fix - for asterisk and SER to run and
> Ingo´s patch - as they say on lists - are still experimental.
>
> Do you have any experience about those soft real-time ways?
There's some nice kernel patches out there; Ingo's RLIMIT_RT_CPU would
solve the problem easily -- it's actually similar to the API that's
provided on Darwin.
I needed something to work sooner, so I have a simple wrapper program,
called "asterisk-rt", whose usage is like this:
./asterisk-rt
usage: asterisk-rt <-u uid> program
And, you can run it like "asterisk-rt -u asterisk-user /path/to/asterisk
<options>"
It then will start the asterisk process with real-time priority, and
also fork two other processes: A normal-priority "canary", and a
higher-real-time priority "watchdog". These processes are connected via
a pipe. The canary says "hello" on the pipe every second. If the
watchdog doesn't hear from the canary in 5 seconds or so, then it will
whack the asterisk process with a "non-real-time priority stick",
assuming that it's gone into a spin-loop, and made your system unusable.
Also, there's a patch to asterisk, which causes it to always drop
real-time priority when it does things like fork AGIs etc, since it's
really not necessary to have some perl script loading a million perl
modules with real-time priority :)
-SteveK
More information about the asterisk-dev
mailing list