EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

What latency is needed in a RTOS?

Started by Bresco November 23, 2008
I just read that Linux with the RT patch can get latencies as low as 10uS, 
whilst a 'real' RTOS can get latencies down to 0.1uS.

For safety critical systems (i.e. ABS braking system) or factory automation 
(where the latency directly influences the throughput ) I'd probably opt for 
the lowest latency but there are plenty of systems where latencies can be 
higher.

Or is a lower latency always best? 


Bresco wrote:

> I just read that Linux with the RT patch can get latencies as low as > 10uS, whilst a 'real' RTOS can get latencies down to 0.1uS. > > For safety critical systems (i.e. ABS braking system) or factory > automation (where the latency directly influences the throughput ) I'd > probably opt for the lowest latency but there are plenty of systems > where latencies can be higher. > > Or is a lower latency always best?
The latency will also be dependent on the hardware on which you are running the system (how many clock cycles are needed to do a context switch and how fast the processor clock runs). -- ******************************************************************** Paul E. Bennett...............<email://Paul_E.Bennett@topmail.co.uk> Forth based HIDECS Consultancy Mob: +44 (0)7811-639972 Tel: +44 (0)1235-811095 Going Forth Safely ..... EBA. www.electric-boat-association.org.uk.. ********************************************************************
On Nov 23, 8:14=A0pm, "Paul E. Bennett" <Paul_E.Benn...@topmail.co.uk>
wrote:
> Bresco wrote: > > I just read that Linux with the RT patch can get latencies as low as > > 10uS, whilst a 'real' RTOS can get latencies down to 0.1uS. > > > For safety critical systems (i.e. ABS braking system) or factory > > automation (where the latency directly influences the throughput ) I'd > > probably opt for the lowest latency but there are plenty of systems > > where latencies can be higher. > > > Or is a lower latency always best? > > The latency will also be dependent on the hardware on which you are > running the system (how many clock cycles are needed to do a context > switch and how fast the processor clock runs). > > -- > ******************************************************************** > Paul E. Bennett...............<email://Paul_E.Benn...@topmail.co.uk> > Forth based HIDECS Consultancy > Mob: +44 (0)7811-639972 > Tel: +44 (0)1235-811095 > Going Forth Safely ..... EBA.www.electric-boat-association.org.uk.. > ********************************************************************
Linux with RT patch is not available on as many platforms as real RTOS are, and is not flexible. So there is not much point in trying to make it work in a RT enviroment. Latency is what every you need in an RTOS. Sometimes the latency is (relatively) low but you use one to manage power requirements anyway. I think FreeRTOS has an example of building a project 'superloop' compaired to RTOS, and it is commented once the multiple RT aspects are handled with RTOS you can then tune down or up the tick rate. ,
Bresco wrote:
> I just read that Linux with the RT patch can get latencies as low as 10uS, > whilst a 'real' RTOS can get latencies down to 0.1uS.
That statement is wrong, if only because it fails to name any hardware it's talking about.
> For safety critical systems (i.e. ABS braking system) or factory automation > (where the latency directly influences the throughput ) I'd probably opt for > the lowest latency but there are plenty of systems where latencies can be > higher.
What makes you assume that the limit on latency has anything to do with safety criticality?
> Or is a lower latency always best?
No. Lower latency than you really need, at a higher price than you can afford, is never best.
Paul E. Bennett wrote:
> Bresco wrote: > >> I just read that Linux with the RT patch can get latencies as low as >> 10uS, whilst a 'real' RTOS can get latencies down to 0.1uS. >> >> For safety critical systems (i.e. ABS braking system) or factory >> automation (where the latency directly influences the throughput ) I'd >> probably opt for the lowest latency but there are plenty of systems >> where latencies can be higher. >> >> Or is a lower latency always best? > > The latency will also be dependent on the hardware on which you are > running the system (how many clock cycles are needed to do a context > switch and how fast the processor clock runs). >
Latency is dependent on the complete system, not just the OS, and is dependent on what is happening during different high-priority event handlers (i.e., if a high-priority interrupt handler takes a long time to run, it may have low latency but cause high latencies elsewhere). And for some systems, average latency is more important than maximal latency (imagine a sampling system where there is a small external FIFO). So for any safety-critical system where you want an analysis of the latencies, pick the simplest system you can. Linux, or any other large OS, would be a very bad choice for an ABS.
On Sun, 23 Nov 2008 19:58:56 +0100, Bresco wrote:

> I just read that Linux with the RT patch can get latencies as low as > 10uS, whilst a 'real' RTOS can get latencies down to 0.1uS. > > For safety critical systems (i.e. ABS braking system) or factory > automation (where the latency directly influences the throughput ) I'd > probably opt for the lowest latency but there are plenty of systems > where latencies can be higher. > > Or is a lower latency always best?
All else equal, lower latency is always best. But all those other things are rarely ever equal. If your OS is meeting the latency requirements for your application, then there isn't a lot of urgency in reducing it. There is an _advantage_, because it's always nice to have headroom for letting the latency grow as the product evolves, but if your application demands only a 1-second guaranteed latency and you're achieving 1/4 second, then you probably don't care much (and yes, that's an extreme example, but if you're controlling the level of water behind a dam it may be real, to, and life- critical to boot). So whether you need a screaming fast real-time kernel that just provides task switching and otherwise stays the heck out of the way (which would probably be appropriate for those anti-lock brakes), or you need a full- featured OS to run some "big box" application that, incidentally, needs to put up picture-in-picture video without introducing more than a frame delay, pretty much determines whether you want something like freeRTOS or RT-Linux. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
On Sun, 23 Nov 2008 19:58:56 +0100, Bresco <bresco@mixmaster.org> wrote:
>I just read that Linux with the RT patch can get latencies as low as 10uS, >whilst a 'real' RTOS can get latencies down to 0.1uS.
>For safety critical systems (i.e. ABS braking system) or factory automation >(where the latency directly influences the throughput ) I'd probably opt for >the lowest latency but there are plenty of systems where latencies can be >higher.
>Or is a lower latency always best?
It depends on the application. I've done realtime control where the acceptable latencies for some areas were a full second.
On Sun, 23 Nov 2008 22:57:44 +0100, Hans-Bernhard Br&ouml;ker wrote:

> Bresco wrote: >> I just read that Linux with the RT patch can get latencies as low as >> 10uS, whilst a 'real' RTOS can get latencies down to 0.1uS. > > That statement is wrong, if only because it fails to name any hardware > it's talking about. > >> For safety critical systems (i.e. ABS braking system) or factory >> automation (where the latency directly influences the throughput ) I'd >> probably opt for the lowest latency but there are plenty of systems >> where latencies can be higher. > > What makes you assume that the limit on latency has anything to do with > safety criticality? > >> Or is a lower latency always best? > > No. Lower latency than you really need, at a higher price than you can > afford, is never best.
Thank you Hans -- you said what I was trying to say, only much more succinctly (and with lower latency, too :-)). -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
AZ Nomad wrote:
> On Sun, 23 Nov 2008 19:58:56 +0100, Bresco <bresco@mixmaster.org> wrote: >> I just read that Linux with the RT patch can get latencies as low as 10uS, >> whilst a 'real' RTOS can get latencies down to 0.1uS. > >> For safety critical systems (i.e. ABS braking system) or factory automation >> (where the latency directly influences the throughput ) I'd probably opt for >> the lowest latency but there are plenty of systems where latencies can be >> higher. > >> Or is a lower latency always best? > > It depends on the application. > > I've done realtime control where the acceptable latencies for some areas were > a full second.
my favorite example of a realtime system is payroll: Payday is a _hard_ deadline but the latency (time interval between inputs and outputs) can be days. Bob ** Posted from http://www.teranews.com **
In message <ggc95l$74h$1@aioe.org>, Bresco <bresco@mixmaster.org> writes
>I just read that Linux with the RT patch can get latencies as low as 10uS, >whilst a 'real' RTOS can get latencies down to 0.1uS.
Linux, like UNIX is not really an RTOS . As for latencies those figures only mean something when you are doing comparisons on the same hardware.
>For safety critical systems (i.e. ABS braking system) or factory automation >(where the latency directly influences the throughput ) I'd probably opt for >the lowest latency but there are plenty of systems where latencies can be >higher.
Do you need and RTOS? a lot (most?) embedded systems don't use them. In fact I would go so far as to say the default is not OS and you only go to one if you really need to. An OS is more SW which needs more memory and power and requires a lot more checking. It adds complexity. Also you need determinism as much as latency.
>Or is a lower latency always best?
No. The correct latency is the best. Real time means on time. You don't need a Ferrari to go shopping in town on a Saturday. -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

The 2024 Embedded Online Conference