Windows does not natively support a real-time deterministic operation.
However, there are many so called “Windows real-time extensions” that can provide developers with a solution to take full advantage of Windows functionality while still preserving the real-time requirements of their application.
Below one can find a guideline for customers with the need for running real-time applications on Windows:
- Windows and Real-time: Background
Background information about the Windows and Real-time Operating Systems
- Requirements for Real-time Behavior in Windows
What must be considered if Real-time applications shall run on Windows
- Windows Real-time Extensions in Comparison
What solutions are available, what are the differences
- How RT-Linux Satisfies All Requirement
Why Real-time Linux has become the best choice today
Windows and Real-time: Background
The difference between a regular Operating System (OS) and a real-time OS (RTOS) that is typically found in many embedded systems, is the response time to external events. Regular OS’s typically provide a non-deterministic, in some cases soft real time response, where there are no guarantees as to when each task will complete, but they will try to stay responsive to the user. An RTOS differs in that it provides a hard real-time response, providing a fast, highly deterministic reaction to external events. The difference between the two can be highlighted through examples – compare, for example, the editing of a document on a PC to the operation of a precision motor control.
When switching between Tasks the RTOS has to choose the most appropriate task to load next. There are several scheduling algorithms available, including Round Robin, Co-operative and Hybrid scheduling. However, to provide a responsive system most RTOS’s use a pre-emptive scheduling algorithm.
In a pre-emptive system each Task is given an individual priority value. The faster the required response, the higher the priority level assigned. When working in pre-emptive mode, the task chosen to execute is the highest priority task that is able to execute. This results in a highly responsive system.
One may think that if you embed your software into a Windows driver, the software may fulfil deterministic and real-time requirements.
Windows will perform requests to the OS in a way to get maximum average computing performance and fast interactive user response. But there will be no response time guarantee. The same is true for both, regular Windows applications, even if threads run with Windows’ real-time priority as well as for Windows drivers because the underlying Windows operating system mechanisms are the same for both.
A good background article about why Windows is not a real-time operating system can be found here.
Requirements for Real-time BehaviorThe Runtime System
To guarantee deterministic real-time performance, the underlying runtime system, which is responsible to execute the real-time operations, needs to be completely independent from Windows. It must provide a variety of functionalities to fulfill todays typical real-time requirements, such as:
- Memory management (heap and stack)
- Multithreading: deterministic real-time scheduler
- Multi-Processing: running multiple independent instances of applications
- Protection between the application layer from the underlying core runtime system
- Thread/Process Synchronization and Communication capabilities
- Multi Core support (Symmetric Multiprocessing)
In summary, these are all of typical features that a real-time operating system provides. Therefore, a real-time operating system is required for real-time behavior in Windows. Consequently, a runtime system that provides at least some of the above features can also be called a real-time operating system (RTOS), and this RTOS must be completely independent from Windows wherever real-time requirements exist.
Isolation is a key requirement to achieve reliable and secure operation of real-time applications alongside Windows. Besides the isolation of the runtime system from the executed real-time applications, the runtime system must also be isolated and protected from Windows. Memory Management and Virtualization technology should be used to achieve maximum isolation.
Even though the runtime system used in a Windows real-time extension is a real-time operating system, there are a variety of aspects to consider to preserve these features when running alongside Windows on a modern PC architecture. Access to shared hardware resources, like Cache and RAM, is one of the most critical aspects. System Management Interrupts (SMIs) also may lead to unacceptable delays. Therefore, the runtime system must address these topics. Utilizing Cache Allocation Technology helps to overcome shared cache issues while Virtualization Technology can be used to cope with SMIs. Furthermore, a Windows real-time extension should also provide tools for analyzing the real-time response of a specific hardware.
C/C++ Runtime Library
The C/C++ runtime library is a set of low-level routines used by the compiler to invoke some of the behaviors of the runtime system, by inserting calls to the runtime library into compiled executable binary. The C/C++ runtime system implements the execution model, built-in functions, and other fundamental behaviors of the C/C++ programming language. Besides the basic C/C++ language support today’s requirements go beyond and look for higher level libraries like STL or Boost.
The main use of a Development Environment is to provide different components of software applications for developing and developing the application. An Integrated Development Environment (IDE) is a tool which integrates all the required applications like compiler, linker, and debugger under a single graphical environment. The thing which makes them most favored amongst the developers is their appealing user interface and capabilities. On Windows the Microsoft Visual Studio IDE has become the de-facto standard for application development, and therefore a Windows real-time extension must be able to utilize this IDE for real-time applications as well.
Popularity, Flexibility, and Portability
To gain the most benefit out of the RTOS, the Windows real-time extension should use a popular RTOS that is widely used, one with lots of features, third party products, and documentation available, and one which is flexible in its usage. If the same real-time application can also be executed stand-alone on a PC without running Windows, or even on an ARM based embedded system, that will ensure a maximum in future flexibility.
A Comparison of Windows Real-time ExtensionsNot All Real-time Extensions are Equal
Not all real-time extensions for Windows are implemented the same, and there are important benefits and trade-offs to consider. As described above and contrary to what users might be led to believe, these real-time extensions do not make Windows itself a real-time OS (RTOS). Existing Windows applications are not automatically going to behave like real-time applications when a Windows real-time extension is implemented. Instead, a real-time system is needed for the real-time behavior – and such an environment is an RTOS.
Typically, Windows real-time extensions implement a proprietary RTOS in parallel to Windows, or sometimes even embedded into Windows. These RTOS solutions are never or rarely used in other types of applications.
In these solutions any application that wants to be a real-time application with real-time behavior must run in this proprietary RTOS. This can be a challenge for developers as they must learn and use the proprietary environment for developing their real-time applications. Furthermore, they must rely on the features that have been decided to be implemented by the manufacturer of this RTOS, which can sometimes be lacking or take time before things are fully available.
LxWin – acontis’ Solution is Different
acontis’ real-time extension, LxWin works differently than a traditional Windows real-time extension and provides an interesting alternative that users and implementors of real-time applications should consider. First, LxWin uses a more segregated approach for the real-time applications and the non-real-time Windows part. Rather than using a proprietary RTOS, LxWin embeds a Linux hard real-time kernel on top of a real-time hypervisor. This hypervisor is key and ensures much better isolation from Windows compared to traditional real-time extensions.
RT-Linux is the most popular RTOS
In addition, and most importantly, LxWin uses open source Linux for the RTOS, not a proprietary RTOS. This is a key feature because over the last several years, Linux has become the most widely used operating system for industrial real-time applications. This means that developers can use all the popular tools and packages already available from the open source community for Linux and not need to learn a new proprietary RTOS.
The use of Linux as the RTOS within a Windows real-time extension makes perfect sense for industrial applications that need real-time behavior. Originally, the real-time Linux development activity was driven by the Open Source Automation Development Lab (OSADL), and major companies like AMD, Intel, BMW, Roche, Phoenix Contact, and KUKA were all members of this organization. In 2016, as the development of real-time Linux became more and more popular, the Linux Foundation took over the management of the project to push the main-line Linux kernel itself into a real-time operating system. This goal is expected to finally be realized sometime later this year or in 2021. More information can be found at the Real Time Linux project website.
Acontis is in a unique position to see the trend for industrial applications and the operating systems that are most widely used. Our EtherCAT Master software, EC-Master, that today supports over 25 different operating systems, typically needs to run in a real-time operating system for best and fastest performance. Today, we see Linux as the most popular choice with over 35% of all EC-Master customers using Linux, and an increasing number of new customers choose Linux, so we expect this percentage to increase.
We also see this trend in the broader industrial market beyond just EtherCAT applications. Leading global companies providing machine, motion, and robotics controllers, as well as PLCs, semiconductor manufacturing machines, and test and measurement solutions, have all started to implement Linux-RT instead of other legacy real-time operating systems.
Finally, in the upcoming new real-time Ethernet standard known as Time Sensitive Networking (TSN), RT-Linux will play a key role as the most favored operating system. See here for what’s ongoing in this exciting future technology on Linux:
Besides RT-Linux, acontis provides alternative solutions for specific use cases where customer for example already use another RTOS natively: https://acontis.com/en/windows-and-rtos.html
How RT-Linux Satisfies All Requirements
Taking the above-mentioned requirements for a Windows real-time extension into account, it is obvious that RT-Linux is the today’s best choice.
The Runtime System
RT-Linux provides all the functionalities to fulfil todays’ requirements to an RTOS. It is one of the most powerful, if not the most powerful operating system on the market. Depending on the real needs, it can also be downsized significantly to only include typical components needed for real-time applications. Linux is not only used in servers; it is also used in small embedded devices like smart watches or TVs where footprint always is an issue. Thus, RT-Linux is small and powerful as well.
For CPU demanding applications, LxWin also supports Symmetric Multiprocessing (https://en.wikipedia.org/wiki/Symmetric_multiprocessing, https://www.ibm.com/developerworks/library/l-linux-smp/) where multiple CPU cores can be used for the real-time application: https://acontis.com/en/lxwin-v6-2-5-new-features.html.
RT-Linux itself has secure and reliable isolation between the real-time applications and the Linux kernel. While not critical for real-time applications, it even addresses vulnerabilities like Meltdown. See here: https://en.wikipedia.org/wiki/Kernel_page-table_isolation.
In addition, Windows and RT-Linux are securely isolated using MMU mechanisms, even more isolation can be achieved when enabling Intel Virtualization Technology. See: https://acontis.com/en/lxwin-7-0-06.html
LxWin provides a simple tool for analyzing the real-time capabilities. 3 lights quickly show whether the system is sufficient for real-time applications. See here for more information: https://acontis.com/en/measurement-setup/articles/MeasurementSetup.html.
Acontis recently started creating a selection of pre-validated hardware that are suitable to being used for real-time applications: https://acontis.com/en/realtime-support-pre-validated-hardware.html
To enhance real-time capabilities, CAT as well as Intel VT can be utilized: https://www.acontis.com/en/lxwin-7-0-06.html
C/C++ Runtime Library, Drivers, Third-Party Software
Besides being a real-time kernel, Linux itself brings with it many useful benefits. Sophisticated features like sockets, a full POSIX API, user space / kernel space isolation, multitasking and multiprocessing are all available (See here for a good overview of the C core library: https://www.gnu.org/software/libc/manual/pdf/libc.pdf.). For almost any hardware available on the market today, a Linux driver is available. This means that developers do not need to wait for a specific driver to be implemented and released by the manufacturer of a proprietary real-time extension platform. Finally, with Linux there is a wealth of software libraries, protocol stacks, and middleware (both open source as well as closed source commercial products) available: C++ STL, Boost, Corba, OPC/UA, DDS, AVB/TSN, EtherCAT, PROFINET, Software-based PLC, motion control Libraries, CNC solutions, and many, many more.
For customers using the EtherCAT technology, acontis provides the EC-Win Windows EtherCAT platform which is based on LxWin: https://acontis.com/en/ethercat-windows-realtime.html. See also the details about the acontis EtherCAT master stack for Linux here: https://acontis.com/en/ethercat-master-linux.html. Finally, customers with the need to simulate an EtherCAT network in real-time can run the acontis EtherCAT simulator software EC-Simulator on Windows by utilizing LxWin: https://acontis.com/en/ethercat-simulation.html
The core part for developing and debugging real-time applications is the support for Microsoft Visual Studio. Project Wizards help to enable customers getting real-time applications created in an easy and logical way – as simple as creating Windows application projects.
Also debugging is done in the same way as debugging regular Windows applications.
See also: https://acontis.com/en/windows-realtime.html.
Alternatively, customers familiar with Eclipse also can use this powerful IDE, either on Linux or on Windows: https://www.eclipse.org/cdt/
Popularity, Flexibility, and Portability
Linux today is the most popular operating system for embedded systems. It is available on Intel x86 (32-bit as well as 64-bit). Applications written for the PC platform can easily be ported to embedded ARM architecture as the operating system ensures reusability of the existing sources.
Customers using Microsoft Windows Embedded Compact (formerly Windows CE) currently are in the need to switch to an alternate solution since Microsoft will stop providing updates and support for these systems. The most popular migration path is RT-Linux and one may consider using LxWin if Windows features need to be preserved: https://acontis.com/en/windows-ce-embedded-compact-end-of-life-a-migration-path-for-real-time-solutions.html
Challenges in Making a Linux Kernel Real-time
There are, of course, still some challenges to using Linux for real-time applications. One of the most difficult tasks is configuring the Linux kernel for real-time behavior. Until the main-line Linux kernel is fully realized as a real-time kernel, developers today must patch the kernel and configure the kernel specially to achieve real-time. This is often referred to as the RT-PREEMPT patch but can be many patches and not all of them are working perfectly.
With LxWin however, developers do not need to bother at all with the Linux kernel configuration and build. The Linux kernel that comes with LxWin is already appropriately patched, configured, and tested as a hard-real-time kernel with deterministic behavior. As a result, extremely short cycle times down to 50 microseconds can be achieved.
LxWin Most Important Features Summary
- Available for Windows 7 and later Windows versions (32 Bit and 64 Bit)
- Fast response time within microseconds and full independence from Windows, if Windows crashes, the real-time part continues to work!
- Optimized utilization of multi core systems (scalable from one to multiple CPU cores for the real-time part)
- Intuitive and popular real-time API (processes, threads, events, sockets, POSIX support, …)
- Support of the Microsoft Development Tools (Visual Studio)
- Comfortable Debugging environment for the real-time part using the Microsoft tools, real-time applications will be developed and debugged just like a normal Windows application
Acontis technologies, based in Ravensburg Germany, was founded in 2001 by the today’s General Managers Christoph Widmann and Stefan Zintgraf.
As a leading provider for EtherCAT® software and Windows® Real-time solutions acontis’ customers cover a broad market range in different sectors like machine builders, medical technology, automation, semiconductors and robotics.
In the future, expansion in the EtherCAT and real-time businesses are on the focus as well as new products in Time Sensitive Networking and OPC UA technology.
Our company is known for high quality products "Made in Germany". The product portfolio is supplemented by professional Training-, Support- and Software Services.
acontis technologies GmbH
Telefon: +49 (751) 5603030
Telefax: +49 (751) 5603031
Telefon: +49 (751) 56030-33