# [SOLVED?] Real Time Kernel / Single User Mode for Gentoo?

## molot

I have a problem and don't have idea where to start (or what to google for). I've tried, but I need your help.

I have to build realtime, single user system for extremely fast measurment. First thought - Gentoo. Single user mode should provide fast enought response. Then, I found some bits of info about real time linux kernel, but no usefull data or links, sadly.

What I need:

Real Time responce - I must be sure that the most important task that can run (not waiting for anything) is the one that's running, short time between signal and effect.

Small or no multitasking - No things should even try to run or use disk, ram etc during measurement.

Graphical control - Just putting letters on screen is not enought today. Especially when it's faster to just show the chart and let the operator think is it going to blow or not than calculate it in machine.

Help me please - where should I start?

----------

## linuxtuxhellsinki

Maybe you'll find some help from here   :Confused: 

http://www.linuxdevices.com/articles/AT8073314981.html

----------

## nephros

"Single user mode" isn't something magical  - it's a normal runlevel where no networking-related init scripts are executed and only one getty (the console login screen) is running.

As far as performance is concerned, it shouldn't be any different from multiuser (or nonetwork) mode with just one user logged in (provided no resource-hungry networking stuff is loaded).

Now, realtime is a totally different monkey and really unrelated to single-user.

Perhaps you could elaborate on how you want that Linux box to be used so people better view to base their tips on?

----------

## molot

I need a constant flow of data at rate about 300`000 12-bit samples per second, both to PCI card D/A converter and from A/D converter on this card. More, I need fast response to the card's trigger and guarantee of fast processing of certain pieces of recieved data (detecting critical  values, like overheat). Fast may not be best word here... More than anything else - guaranted maximum of time is needed, possibly small.

----------

## bollucks

How small? It makes a big difference what requirements you have. If it's in the order of <100ms then the standard mainline kernel is fine. If you need more like <100us you need the preempt-rt kernel.

----------

## molot

 *bollucks wrote:*   

> How small? It makes a big difference what requirements you have. If it's in the order of <100ms then the standard mainline kernel is fine.

 I wish it was like that. However, most important data will be in about 1 - 10ms after trigger.

 *bollucks wrote:*   

> If you need more like <100us you need the preempt-rt kernel.

 Ok, thank you, now I know what to look for.

If anyone has any usefull links, they would be great help.

----------

## bollucks

Look here:

http://people.redhat.com/mingo/realtime-preempt/

There may be an ebuild of that kernel tree somewhere but rt-preempt is updated so fast you're probably better off building your own as any ebuild will be constantly out of date.

----------

## yabbadabbadont

If your budget can afford it, get QNX.  It is sort of a real-time BSD variant and is widely used for real-time systems.  A lot of the ATM networks use it for the switching software.  Note: it is used for a lot of the network infrastructure, not the ATM's themselves.  (at least not so much anymore)

----------

## molot

We can't afford this one, sadly. Neither price of licences for QNX nor time needed to learn new api encourages us to do this.

I think I've found solution. RTLinux or other hard-realtime systems based on Linux seems to do exactly what I need.

Besides, some of them are free, so no problem with costs.

----------

## chairmanK

[quote="molot"]I think I've found solution. RTLinux or other hard-realtime systems based on Linux seems to do exactly what I need.

Besides, some of them are free, so no problem with costs.[/quote]

FSMLabs RTLinux Free works, although you may trouble getting it to build on your system (try the older versin of the kernel, and use gcc-2.95). I use it in the neurophysiology laboratory where I work. RTLinux not well documented, however. You need to spend some time looking at the source code to figure out how to write your applications appropriately to make use of the RT modules.

----------

## Dominique_71

You can get a realtime kernel at pro audio production applications portage overlay. Just install the overlay, and emerge rt-sources and rtirq.

The scripts in rtirq fix both the hardware and software priority at boot time and are very easy to adapt.

I fully agree with nephros, if you have enough ram, even a monster as kde have the same realtime performances as the console. It take more time to load, but after, the performances are the same.

A such rt-kernel will not be good is you want very low latency (about some nano sec). For that, you have to look at http://www.isd.mel.nist.gov/projects/rtlinux/intro-rtl.pdf for a general discussion and at RTAI - the RealTime Application Interface for Linux

----------

