Linux Wins - Or Does It?RTOSes are dying, Linux is in. Or is it?
At the recent RTECC conference Jim Ready, founder of Montavista (which has been part of fast-growing but profit-challenged Cavium since 2009) claimed that there really isn’t much need for RTOSes anymore, as Linux can be used instead.
Ironically, Jim created VRTX, one of the very first commercial real-time operating systems back in 1980. Not a week goes by that I don’t hear a similar statement from some pundit, or get email from an engineer wondering if sticking with an RTOS is a bad idea in view of Linux’s many virtues.
Apart from the whole hard- or soft-real-time debate, there are a lot of reasons why Linux will always be a non-starter for huge classes of embedded systems. One of those reasons is that it just does not work in the limited address spaces of microcontrollers, and MCUs are not going away. In fact, they are proliferating as never before.
A quick look at Atmel’s site reveals 258 variants of their immensely popular AVR line. That’s in addition to the 51 kinds of 8051s they sell. Microchip has over 650 microcontrollers, a number that seems to balloon constantly. Freescale packs about 175 eight and 16 bit MCUs into their line card. Plenty of other vendors supply proprietary-architecture controllers.
Then there’s ARM.
NXP offers about 140 different microcontrollers using Cortex-M series cores. NXP has about 200. TI pushes around 400. Dozens of other vendors offer ARM-based microcontrollers. No doubt there are over 1000 MCUs that use the Cortex-M-series processor.
Why focus on the M series? Linux will never run on these parts. The vast majority of them are used in applications that run from on-board memory, which never exceeds a few hundred KB.
To a non-embedded person acquainted with Intel’s never-ending pursuit of performance the Cortex-M family would seem an anachronism, a step back into the era of scarce CPU cycles. But that person would be astounded to learn of the computer in his toothbrush or the millions of transistors used in a programmable thermostat to replace a simple mercury switch. An essential truism of computing is that the race to the top in performance is always matched by a race to the bottom: the bottom in price, power and in size.
But the real-time debate is important as well. At the most recent ESC the nice folks at Petalogix demonstrated Linux running on one core in a Xilinix FPGA and FreeRTOS in another. I was struck by the following performance graph produced by one of their tools:
Click on image to enlarge.
(Chart courtesy of Petalogix)
Interrupt latency is, in some systems, hugely important. (If you are thinking about Linux-ing an FPGA, do check out their tools at www.petalogix.com).
The truth is that in the world of embedded systems applications range from electric toothbrushes and greeting cards to massive weapon systems. Linux is well-suited for some of these; a traditional RTOS is the right choice for others. We engineers benefit from having both in our toolbox.
Jack G. Ganssle is a lecturer and consultant on embedded development issues. He conducts seminars on embedded systems and helps companies with their embedded challenges. Contact him at firstname.lastname@example.org. His website is www.ganssle.com.