Real-time computing means much more than getting a seemingly immediate response after hitting Enter. In fact, its real meaning involves interfacing to real machines doing real things in, well, their own real time.
Take, for example, the Gleason 600HTL Turbo Lapper, whose controller was designed by Viewpoint Systems in Rochester, N.Y. Basically, it laps beveled gears (that is, polishes them by grinding an abrasive slurry between them) until they mesh so perfectly they purr rather than clatter -- an attribute important to the car makers that use the beveled gears in car differentials, explains John Campbell, vice president at Viewpoint.
The two gears being polished mesh against each other at right angles while spinning as fast as 3,100 rpm, passing the same point of contact about 52 times per second. But Viewpoint was able to incorporate into the controller a real-time computing system from National Instruments (NI) that can analyze the response of the gears about 20 times faster than that, or about a thousand times per second.
"By looking at variations in the rotation speeds, we were able to detect high and low spots in the gears, and drive a secondary motor to adjust the torque, pushing harder on high spots, backing off on low spots," explains Campbell. Therefore it can correct a problem spot as that spot is identified, while the spinning gears are still meshed at that spot.
"In the end we were able to improve lapping time by 30%," since the machine knows exactly when it's finished polishing a gear, rather than relying on averages, Campbell adds.
Real-time v. real fast
But while the results were positive, a frequency of a thousand times a second is hardly noteworthy in this age of gigahertz processors. As it turns out, however, real-time computing is not about speed.
"When people talk about real-time computing there are certain common misconceptions, especially that reacting in microseconds or nanoseconds makes the system real-time, and taking five minutes means it is not real-time," says Prashant Dubal, senior director of product management at Wind River Systems, a subsidiary of Intel and maker of the VxWorks real-time operating system. "But real-time means that the system reliably takes the same amount of time every time it does a certain thing. Duration does not matter."
"If the system's highest priority is blinking a red LED, it always honors that priority, and no matter what else is happening, when the light needs to blink it leaves everything aside to do that, and do it quickly," Dubal explains.
"Traditionally real-time was measured from the perspective of human patience, and if you pushed a button and got information within a second that was real-time," agrees David Barnett, vice president of Real-Time Innovations, a systems integrator in Sunnyvale, Calif. "But a real-time system is one that behaves deterministically, responding predictably to inputs or changes in the environment. Typically these are cyber-physical systems, used to manage a physical process.
"Observers often confuse real-time computing with high-speed computing, such as financial trading or sports betting," adds Barnett. "The difference between high-speed computing and real-time computing is that with high-speed computing you are talking about averages -- you can say on average an operation takes a millisecond. But one time in a thousand it takes much longer. With real-time computing you are confident the operation took place within the deadline, or you know it didn't happen."
Deterministic responses are not accidental, and require a real-time operating system (RTOS), of which there are several dozen on the market -- although, as with many established industries, there are three leaders.
"Wind River with VxWorks is the overall leader," says Barnett, "and then there's Green Hills Software with Integrity, popular in aerospace and defense; and QNX from QNX Software Systems, owned by BlackBerry, popular in automotive and healthcare." Wind River also has a real-time version of Linux.
"Determinism must be baked in; you will not see it on a desktop," says Grant Courville, director of product management at QNX. "You have to care about every CPU cycle and every microsecond. It has to be designed for consistency."
While NI was able to make a real-time version of Linux (NI Linux Real-Time), the effort involved was not trivial, notes Jamie Smith, NI's director of product marketing for embedded systems. "We did an evaluation at the kernel level, dug in and did extensive modifications and testing. The team was fairly large. But this brings real-time computing to the hands of engineers who are not embedded software engineers."
Of course, there will be variations between the time it takes the system to perform the same task at separate moments, and this tolerance is called jitter.
"It determines how good an RTOS is, but it is also very hardware dependent," says Dubal. "Ours is usually two-digit nanoseconds."
Barnett says that with modern processors, jitter is usually measured in microseconds, which is good enough for most applications.
Jitter is not worth talking about with general-purpose programming environments like Java, since they are optimized around a typical case, Barnett adds. "If it is out of memory and needs to do garbage collection to free up memory, it stops to do that, and blocks out all other processing. In real-time computing you devote a little extra work to things like that on every cycle, to avoid longer delays later."
"The jitter on something like (standard) Linux is hundreds of milliseconds," adds Dubal. (NI product literature says the jitter for NI Linux Real-Time is comparable to that for other NI real-time environments.)
The Internet of Things
But the big trend, sources agree, is that (as with the rest of the computer industry), prices are coming down while systems are becoming more powerful. In the case of real-time systems, that means inexpensive and powerful controllers, optimized for machines interfacing with other machines, are arriving just as the Internet of Things begins to need them.