Under the Hood of NI Linux Real-Time


The NI LabVIEW Real-Time Module supports the NI Linux Real-Time OS, available on select NI hardware. In this article, learn about specific new features and advanced topics to get the most out of NI Linux Real-Time for your application.


Linux Shell Support

The NI Linux Real-Time OS offers full Linux shell support so you can perform complex administrative tasks to manage real-time targets more easily. To access the shell, you need a terminal client. If you are using Windows 7 and later, PuTTY is a popular and free client at PuTTY: A Free Telnet/SSH Client.

In addition to a terminal client, you must select the Enable Secure Shell Server (sshd) option on the real-time target running the NI Linux Real-Time OS. You can use either NI Measurement & Automation Explorer (MAX) or the Web-Based Configuration and Monitoring Interface (see Figures 1 and 2). For security purposes, changing the default password on the admin account is highly recommended. You can change the password through the Web-Based Configuration and Monitoring Interface. To log in to the Linux shell over SSH, you can then use the admin user name along with the password you have configured to get root access—the password is blank if not configured. You can create additional users through the Web-Based Configuration and Monitoring Interface. These users can also log in over SSH, but will not have root access.

Figure 1. You can find the Enable Secure Shell Server (sshd) option on the System Settings tab for the real-time target in Measurement and Automation Explorer. You must select this option before you can access the real-time target running NI Linux Real-Time.


Figure 2. You can also find the Enable Secure Shell Server (sshd) option through the Web-Based Configuration and Monitoring Interface for the real-time target. You must select this option before you can access the real-time target running NI Linux Real-Time.


File Transfer and File Paths

Starting with LabVIEW 2013, all NI real-time targets support WebDAV file transfer. WebDAV is an industry-standard protocol that is built on top of HTTP. Popular applications such as Dropbox use it and you can easily secure it to transfer files containing sensitive information. WebDAV is the default file transfer mechanism for real-time targets running NI Linux Real-Time. Learn more at Using WebDAV to Transfer Files to Your RT Target.

Unlike older devices based on VxWorks and Phar Lap, NI Linux Real-Time targets do not have an FTP server installed by default. If you require FTP support to keep applications backward compatible, you can install a legacy unsecure FTP server through MAX. Learn more about FTP support for NI Linux Real-Time at How do I Use FTP with my NI Linux Real-Time Target. NI Linux Real-Time targets also support SFTP functionality through SSH as well in case WebDAV is unsuitable for a given application.

Additionally, NI Linux Real-Time introduces a few important file path differences from existing real-time targets and from Windows. To prevent errors in file paths when migrating code or managing data logs on a target that supports the new Linux-based RTOS, refer to this document.


Programmatic System Access

The LabVIEW Real-Time Module supports the System Exec VI on NI Linux Real-Time targets. The System Exec VI on NI Linux Real-Time targets provides access to the Linux command line so you can programmatically manage the NI Linux Real-Time OS and interact with other programs running on the target directly from your LabVIEW Real-Time application.

In addition to the System Exec VI, the Call Library Function Node is also supported on NI Linux Real-Time targets. With the Call Library Function Node, you can more easily integrate external C/C++ code with your LabVIEW Real-Time applications and create LabVIEW wrappers for any C APIs provided by other programs installed to and running on an NI Linux Real-Time target.


Figure 3. The System Exec VI and Call Library Function Node are supported on NI Linux Real-Time targets. You can interact with both the NI Linux Real-Time OS and other programs seamlessly from your LabVIEW Real-Time application.


Access the Linux Ecosystem

Targets that run NI Linux Real-Time can greatly benefit from the vast ecosystem of IP available for Linux. To install, manage, and make use of the ecosystem, rely on opkg, the package manager provided on NI Linux Real-Time. To learn more about opkg, visit OPKG Package Manager. The NI-hosted package repository can be manually browsed at http://download.ni.com/ni-linux-rt.

Beyond giving you the ability to more easily integrate C/C++ code with the System Exec VI and the Call Library Function Node, NI Linux Real-Time targets allow you to use code from the Linux ecosystem, reuse in-house code, and develop, deploy, and debug C/C++ code with an Eclipse-based tool. To learn more about the C/C++ Development Tools for NI Linux Real-Time, Eclipse Edition, see Building C/C++ Applications for NI Linux Real-Time.


Advanced Real-Time Performance

The new NI Linux Real-Time uses a real-time scheduler similar to the one on current real-time targets to handle the time-critical code scheduling and a completely fair scheduler (CFS) to handle all noncritical code scheduling. Current real-time targets with dedicated RTOSs rely solely on a real-time scheduler to manage both time-critical tasks as well as lower priority system tasks. The CFS in NI Linux Real-Time offers improved performance as lower priority tasks are more efficiently scheduled. To learn more about CFS, visit Inside the Linux 2.6 Completely Fair Scheduler.

Beyond the change in scheduler, you should also be aware of differences in multicore support on NI Linux Real-Time as all NI embedded hardware devices which support this new RTOS are multicore. With respect to multicore support, it’s especially important to follow programming best practices and avoid running a time critical loop on a processor core at 100 percent core utilization. This is because each core in multicore NI Linux Real-Time systems needs some amount of time for OS maintenance/overhead functions, without which system performance can be severely affected. To avoid this performance degradation, ensure that time critical loops allow for the CPU to sleep on the order of 10 milliseconds per 10 seconds of operation to allow for overhead processing.

It’s also important to note that performance degradation can occur in both time critical and system tasks on multicore systems running NI Linux Real-Time if serially dependent tasks are allowed to run in parallel across processor cores. This is because of the inefficiency introduced in communicating information between the serially dependent tasks running simultaneously on different processor cores. To avoid any such performance degradation, follow the LabVIEW Real-Time programming best practice of segregating time-critical code and system tasks to different processor cores. You can accomplish this by setting a processor core to only handle time-critical functions, and specify the processor core to be used by any Timed Loop or Timed Sequence structure as illustrated in Figure 4. You can learn more about the best practices in LabVIEW Real-Time for optimizing on multicore systems at Configuring Settings of a Timed Structure.

Figure 4. There are two methods to assigning processor affinity using the Timed Loop structure in LabVIEW Real-Time: (1) set the processor either by double-clicking on the Timed Loop structure to bring up the configuration dialog or (2) wire a value directly to the node on the left of the structure.


As is recommended with all system upgrades, you should re-validate your application after migrating to an NI Linux Real-Time based target as there may be improvements or degradations in the performance of individual functions which may affect your application's ability to meet all system requirements. In particular, memory allocations on Linux based real-time targets can have a greater impact on jitter.


Meet Requirements While Relying on the Familiar

LabVIEW support for the new NI Linux Real-Time offers you a number of benefits to more easily and quickly meet your embedded application requirements today, while still relying on the familiar LabVIEW development environment.

Join in on the discussion at the NI Linux Real-Time Community

Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.