How does real time actually work under Windows?
Anyone familiar with the concept of real time knows how important it is nowadays in numerous IT areas. Whether for parallelly operating servomotors in a robotic arm, precise measurement applications or camera-based driving assistance systems—the reaction times between hardware and software components are a crucial factor in many modern electronic technologies. What once was achieved either through special stand-alone real-time operating systems (RTOS) or hardware (DSP and FPGA), can by now also be implemented by utilizing regular, commercially available Windows PCs. Now, of course, Windows itself is not a real-time system, as it arbitrarily diverts ressources from running applications in order to execute other programs and processes, i. e., for maintenance. So how can these supposed opposites be brought together? How does real time function with Windows?
Real time and Windows – The solution
The only requirement for real time on Windows PCs is a processor with at least two cores. The basic operating principle is to instruct Windows to only use a limited number of CPU cores of a multicore processor. On the now vacant cores, the real-time system is booted, which, from here on out, functions just like a separate RTOS, while Windows retains its full operability on the remaining CPU cores. This means that from this point on, Windows and the real-time system run simultaneously and parallel to each other on the same computer, without one restricting the other. The instruction for Windows to boot on a limited amount of cores can be carried out relatively simple by using the configuration program msconfig. (A guide for this can be found here: Setting up dedicated CPUs)
Thanks to this procedure, the real-time system gains a protected area, therefore ensuring that Windows processes do not obtain a higher priority over time-critical operations and thus preventing it from negatively impacting real-time performance. The ultimate goal is to achieve specifically "hard" real-time capabilities on Windows PCs. But what exactly does "hard" mean in this context?
What is the difference between "soft" and "hard" real time?
When it comes to real time, we need to distinguish between different demands and how the timeframe for executing processes is handled. While "soft" real time only approximates to an average of reaction times, "hard" real time needs to guarantee that a set period of time is not exceeded. Due to these higher requirements, achieving "hard" real-time capabilities is significantly more complex and challenging. This deterministic time behavior, however, is indispensable in automated industrial areas, especially in measurement, testing and control technologies.
So how can Windows context and real-time context be brought back together?
The real-time system is implemented as a device driver and provides its own API, which allows the user to export the time-critical code parts of a Windows application into a DLL. This DLL is then loaded into the real-time context of the RTOS. In order for Windows and the DLL to communicate with each other from their different contexts – besides using indirect methods such as pipes or sockets – a shared memory area can be created, which both have access to. Despite the utilization of a real-time operating system, Windows remains as both programming interface and host system for execution.
Why use particularly Windows as RTOS?
In contrast to pure real-time operating systems as well as real-time hardware solutions, a Windows PC offers specific advantages. Windows itself is a familiar user interface with broad driver support, that is frequently updated, as well as a wide range of executable programs. A pure RTOS, on the other hand, is heavily specialized and therefore oftentimes much more restricted when it comes to function range or operability. Hardware solutions such as FPGAs and DSPs can be adjusted according to different specifications. However, their programming is complicated and time-consuming. To get "hard" real-time working under Windows, only a dual-core PC is required.
Windows is optimally suited for industrial applications due to the following properties:
- wide-spread, intuitive and familiar user interface
- access to the latest communication interfaces
- efficient developer tools
- low implementation and training cost
- long-lasting due to high market share and continuous further development
The missing real-time capabilities of Windows are supplemented by real-time systems such as Kithara RealTime Suite, thus allowing for the implementation of time-critical applications in the first place due to:
- deterministic behavior thanks to high-frequency real-time timers
- extremely low maximum response times
- familiar programming language and tools
- efficient and easy-to-apply functions
- short training time and cost efficient development
- broad support for industrial protocols and standards
Windows and real time are not a contradiction. The seamless interaction of both worlds allows for optimal solutions and often makes the utilization in industrial fields possible to begin with.
See for yourself how real time can be used under Windows. Just test the free trial version of Kithara RealTime Suite with full function range and many samples that help you get started.