|Real Time Linux Project Revitalized|
|Written by Harry Fairhead|
|Tuesday, 27 October 2015|
More and more microcontrollers are nothing of the sort - they are full machines running Linux. However, a powerful processor isn't enough you also need the OS to let you take advantage of it in real time.
If you are developing code for embedded hardware then often there is no operating system to get in the way and you are in complete control of the processor. This is simple and its often cheap but it suffers from a number of drawbacks. If you want your device to join the Internet of Things IoT then you generally need sophisticated services like WiFi and Bluetooth not to mention a file system.
As a result there is a trend for small microcontrollers, typified by the Arduino, to be replaced by complete systems on a chip such as the Raspberry Pi or the Intel Edison. These are much more powerful, but to supply the services they run something like Linux. As time passes the Linux based controller is likely to become the norm for all but the most simple of requirements. But there is a problem.
If you have the processor all to yourself then you can determine, what happens and when. Subject to the processor being fast enough you can set how long process takes and always be ready to receive input or send output to the real world. This is real time processing at its simplest. However if you have an operating system like Linux between you and the processor then you don't get to determine what happens when. The operating system can suspend your program at any time it needs to use the processor for something else. You can no longer guarantee how long a process might take. This can be a serious problem if for example your program is supposed to respond to an emergency condition and it isn't running because a system service has a higher priority.
Hence you need a real time version of Linux and this something that a number of people have worked on for some time.
Real Time Linux development was rolled into the mainline Linux kernel in 2.6.22 back in 2006. It introduced two real time scheduling algorithms that were almost enough to make Linux real time but not quite. Usually it is referred to as "soft realtime" to make the distinction between what it does and the requirements of a "hard realtime" system with guarantees of service times.
Oddly many programmers don't realize that this is the case and still go off looking for a replacement for Linux that is more real time. Of course there are some applications for which soft realtime isn't good enough. To meet this need the Linux Foundation recently announced the new Real-Time Linux Collaborative Project with backing from Google, National Instruments, OSADL, Texas Instruments, Altera, ARM, Intel and IBM.
So what is the project going to add to Linux?
The answer seems to be real time preemption and a high resolution timer layer. The key idea is that the highest priority task gets to run, even if this means preempting an operating system task. This is aimed at reducing the latency of thread switching from an unbounded milliseconds wait to microseconds.
This doesn't quite provide guarantees on service times, because there are parts of the Linux system which are not preemptable, and hence the wait could be longer than promised in the worst case. In other words, there are still going to be people calling it "soft" rather than "hard" realtime because it still isn't deterministic. However, the majority of applications can live with real time preemption and this makes Linux much more attractive on small systems.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Tuesday, 27 October 2015 )|