30.12.2012 Views

30°C Power On 12 to 36 watts - for fanless sealed system design ...

30°C Power On 12 to 36 watts - for fanless sealed system design ...

30°C Power On 12 to 36 watts - for fanless sealed system design ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ESE Magazine Jan/Feb 06 <br />

42<br />

XP & real-time <strong>system</strong>s<br />

Paul Fischer, TenAsys Corp <br />

A virtual machine approach combines a Windows interface with an RTOS.<br />

TO AUGMENT the flexibility of<br />

Windows as a human-machine interface<br />

OS with support <strong>for</strong> the deterministic<br />

requirements of embedded applications,<br />

<strong>design</strong>ers usually add a dedicated real-time<br />

component (i.e., a second computer).<br />

Un<strong>for</strong>tunately, a second control computer adds<br />

substantial cost of goods, manufacturing complexity,<br />

and <strong>system</strong>-<strong>to</strong>-<strong>system</strong> coordination<br />

headaches. A “single-computer dual-OS” <strong>system</strong>,<br />

where one compute element hosts both the<br />

Windows <strong>system</strong> and the RTOS, significantly<br />

reduces the cost of goods and complexity, and<br />

simplifies the coordination of Windows with<br />

real-time processes.<br />

Typical real-time Windows solutions utilize a<br />

Windows driver inserted in the Windows kernel,<br />

an approach that presents many software <strong>design</strong><br />

challenges. A true dual-OS solution employs virtual<br />

machine technology where the non-deterministic<br />

application elements execute on a “Windows<br />

virtual machine,” and deterministic software executes<br />

on a “real-time virtual machine” (see figure).<br />

A significant advantage of this virtual machine<br />

approach is the leverage application developers<br />

gain by using a single standard development <strong>to</strong>ol<br />

<strong>for</strong> both environments.<br />

Interval timers<br />

Real-time processes and threads running on<br />

the RTOS virtual machine need access <strong>to</strong> highspeed<br />

interval timers <strong>for</strong> accurate, low-drift<br />

time measurements and <strong>for</strong> generating exact<br />

periodic intervals <strong>to</strong> insure precise control of<br />

real-time <strong>system</strong>s. x86 APIC uniprocessor and<br />

multi-processor <strong>system</strong>s, the vast majority of<br />

embedded and desk<strong>to</strong>p Windows plat<strong>for</strong>ms<br />

built <strong>to</strong>day, are excellent candidates.<br />

To insure efficient implementation of realtime<br />

threads, developers need an environment<br />

that supports direct access <strong>to</strong> I/O and memory, a<br />

fixed priority scheduling <strong>system</strong> with priorityinversion<br />

protection, and simplified interrupthandling<br />

services. They can then create and<br />

deploy sophisticated real-time applications<br />

without having <strong>to</strong> write complex and cumbersome<br />

device drivers <strong>for</strong> access <strong>to</strong> real-time<br />

hardware, simplifying development and debugging<br />

of control and data acquisition algorithms.<br />

The net gain of the virtual machine “singlecomputer<br />

dual-OS” approach is elimination of<br />

redundant computer and communication hardware<br />

and faster communication and coordination<br />

between the real-time and Windows appli-<br />

cation parts. The RTOS and its processes run on<br />

the same hardware as the standard Windows<br />

kernel, sharing the CPU, memory, and I/O<br />

resources.<br />

A better approach<br />

The virtual machine approach <strong>to</strong> adding realtime<br />

task processing <strong>to</strong> applications incorporating<br />

Windows is quite different from those<br />

approaches that install a real-time kernel in the<br />

<strong>for</strong>m of a Windows device driver or sub<strong>system</strong>.<br />

The device driver and sub<strong>system</strong> models <strong>for</strong>ce<br />

real-time applications <strong>to</strong> operate as part of the<br />

Windows kernel. Kernel mode code has privileged<br />

access <strong>to</strong> the entire memory space, including<br />

the Windows kernel and other device drivers;<br />

it lacks address isolation and memory protection.<br />

A real-time thread running on such a <strong>system</strong> can<br />

easily overwrite other processes: both real-time<br />

and Windows processes. Because such programming<br />

errors are difficult <strong>to</strong> detect in kernel<br />

mode and result in spurious but critical failures,<br />

achieving reliable operation through this method<br />

often requires extensive testing and debugging.<br />

Many such errors are not detectable until the<br />

<strong>system</strong> has been deployed in the field. Creating<br />

a complex, multi-threaded, real-time application<br />

<strong>to</strong> run inside the Windows kernel is contrary <strong>to</strong><br />

the notion of building reliable, safe, and dependable<br />

real-time applications.<br />

<strong>On</strong> the other hand, using a virtual machine <strong>to</strong><br />

add real-time responsiveness <strong>to</strong> Windows, as<br />

TenAsys’ INtime does, enables the RTOS <strong>to</strong><br />

maintain reliable operation of real-time processes<br />

in the event of a Windows crash. The virtual<br />

machine approach <strong>to</strong> real-time Windows allows<br />

real-time applications <strong>to</strong> run in user-mode, not<br />

kernel-mode. The result is improved reliability<br />

and robustness, as well as simplified programming<br />

and debugging. Each real-time process<br />

runs in a separate 32-bit protected memory segment.<br />

These segments are distinct from those<br />

used by Windows and provide address isolation<br />

and protection not just between the real-time<br />

processes, but also between real-time processes<br />

and non-real-time Windows code.<br />

Dual-core enhancements<br />

Using two virtual machines <strong>to</strong> share a single CPU<br />

plat<strong>for</strong>m that supports Windows and real-time,<br />

works <strong>for</strong> a large number of real-time Windows<br />

applications. Typically, applications with cycle<br />

times of one millisecond or slower are served quite<br />

well by this arrangement and have been deployed<br />

Win32<br />

Processes<br />

Win32 APIs<br />

Windows OS<br />

Windows<br />

Kernel<br />

Windows<br />

Virtual Machine<br />

Real-Time Application<br />

Inter-OS<br />

Communication<br />

Pentium-class processor<br />

Real-Time<br />

Processes<br />

INtime APIs<br />

Real-Time<br />

Kernel<br />

INtime<br />

Virtual Machine<br />

Figure 1: A virtual machine implementation<br />

on an Intel Architecture processor.<br />

on the current crop of desk<strong>to</strong>p and industrial motherboard<br />

plat<strong>for</strong>ms (uniprocessor and hyper-threaded<br />

Pentium 4 class processors running at 1-3GHz).<br />

However, some applications demand faster<br />

cycle times. For these applications the solution<br />

is dual-core processors. Higher speed cycle<br />

times mean higher bandwidth controllers, a<br />

desirable trait because it leads <strong>to</strong> improved per<strong>for</strong>mance<br />

and throughput.<br />

Dual-core processors easily support two operating<br />

<strong>system</strong>s by dedicating one CPU <strong>to</strong> the<br />

RTOS. The CPU instruction cycles of the dedicated<br />

core are available 100% of the time <strong>to</strong> the<br />

RTOS. The CPU cycles of all remaining cores<br />

become the exclusive property of the Windows<br />

virtual machine. Contention <strong>for</strong> key CPU<br />

resources such as pipelines, cache, and the FPU<br />

are avoided. Coordination between the two<br />

processors is accomplished by using built-in<br />

interprocessor communication mechanisms,<br />

eliminating context switch. In this scenario, interrupt<br />

latencies are reduced by an order of magnitude,<br />

from 10-30 microseconds down <strong>to</strong> 1-3<br />

microseconds. Loop cycle times in the 50-200<br />

microsecond range are able <strong>to</strong> operate with high<br />

precision and accuracy. The advent of inexpensive<br />

dual-core hardware means an order of magnitude<br />

improvement in the quality and bandwidth<br />

of control algorithms can be obtained on a realtime<br />

Windows plat<strong>for</strong>m!<br />

An RTOS that shares the CPU with Windows,<br />

using virtual machine technology, allows embedded<br />

Windows applications <strong>to</strong> take full advantage<br />

of the Windows’ standard user interface, network<br />

capabilities, development <strong>to</strong>ols, and off-the-shelf<br />

software and still deliver the per<strong>for</strong>mance required<br />

of critical, hard real-time tasks. <br />

www.tenasys.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!