views:

121

answers:

1

What is the shortest interval at which RT Linux can execute a (real-time) periodic task?

I'm investigating hardware vs. software solutions for a scientific data acquisition app. The requirements include real-time feedback control of physiological processes at approximately 40kHz. There are hardware solutions (using programable DSP chips), but I'm curious whether a real-time linux task could handle the entire problem. The task is simple: read a sample from the A/D board, perform some simple arithmetic and write a sample to the A/D board. Can RT Linux schedule this task 40k times/second or is that an unreasonable speed?

If we can perform the periodic task on the CPU, we can write the app without a hardware dependency. If not, we'll have to use a hybrid CPU/DSP system. Obviously, I'm hoping for the former.

+1  A: 

According to http://www.ibm.com/developerworks/linux/library/l-real-time-linux/, even non-RT linux on a decent processor can deliver on-average 20μs timer interval, which corresponds to 50kHz. The same article mentions that high-resolution timers in 2.6 kernel w/ some RT mods can deliver 1μs intervals, or 1000kHz. So I don't think it is unreasonable to expect a RT kernel to be able to deliver 40kHz reliably.

Michael Bray
non-RT linux can easily deliver *on average* 50kHz, but the requirements for this system are worst-case 40kHz, so non-RT linux is out. Resolution of the timer doesn't guarantee that it can fire periodically at a particular rate; it may be that you can have a timer fire periodically at exactly 232µs, but that 20µs is too fast.
Barry Wark
Yeah.. my point is that if a non-RT can deliver 50k *on average* (due to some intervals getting pre-empted, resulting in a delay) then a RT system should be able to deliver 40k *reliably*. I'm not suggesting that you use non-RT, just using it as a "worst-case" comparison.
Michael Bray