Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Embedded Systems

Is It Real-Time Yet?


Performance Measures

The old rule of thumb that real-time performance increases with each new CPU generation has become invalid, because CPU clock speed no longer doubles every few years. Although multicore CPUs have higher overall throughput, each core has performance that's roughly comparable with current single-CPU chips. The number of instructions and I/O cycles required to handle an interrupt won't decrease and the clock frequency won't increase, so the best-possible latency will remain around 10 s for the foreseeable future.

Interrupt latency and jitter get plenty of attention, mostly because they're easy to measure and summarize on nice graphs. However, the path length from a hardware interrupt to the first instruction in your handler represents just one part of real-time performance; other components probably have a greater effect on overall performance.

If your code performs only a trivial function, such as reading or writing a port using data stored in a FIFO buffer, then OS code determines the total path length from the interrupt to the final operation. Suppose, for example, that the total time required to handle a single interrupt has 10-s latency plus 40 s of hocus-pocus after your code, for a total of 50 s. The maximum repetitive interrupt rate could hit 20 KHz as long as the system does nothing other than handle interrupts.

That might be acceptable for a trivial real-time application such as an arbitrary waveform generator that can precompute a table of output values. Most applications have a husky nonreal-time component handling the user interface and converting input samples into output values, so the real-time component must not completely hog the CPU.

That tradeoff highlights the essential difference between a hard real-time OS and all others: A complete lack of fairness. Desktop and server OS design assumes that all tasks should receive their more-or-less fair fraction of the CPU's total processing power. Priorities and scheduling tweaks may favor one task or task category over another, but everybody has an opportunity to play.

An RTOS, in contrast, ensures that real-time tasks start when they must and run to completion as they should. Unless and until a real-time task yields control, it's in charge. There are various nuances and tweaks that may reduce such absolute control, but that's the starting point.

So, although it's tempting to use the only hard numbers you'll find, things like interrupt latency and task-switch speed might actually be the least of your worries. You must, instead, know numbers that trendy software development methodologies can't predict: The path length through your real-time code and the actual CPU usage of your nonreal-time code.

Good luck with all that.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.