How Hardware Affects Soft Real-Time Performance

Desktop Intel i7 Extreme vs. Embedded High Performance i7

One day I was wanting to test some new hardware I had just put together for my main development PC. My company normally ships machine vision systems using a quality embedded motherboard (Q67 chipset), an Intel i7-2600 3.4 GHz CPU with 4 hyper-threaded cores and 4 GB of RAM running Windows 7 32-bit. There has been no need for more memory or 64-bits yet so we don’t add that complexity, although it will happen in a few months when we switch to a 4th generation i7 and new motherboard from the same supplier (I didn’t have time to include this system in these tests).

My new development system is built using an ASUS X79-DELUXE motherboard, an Intel i7-4930K 3.4 GHz extreme CPU with 6 hyper-threaded cores and 32 GB of RAM running Windows 7 64-bit. I moved my 32-bit development PC into VMware but still have another hardware based 32-bit system for final testing.

As part of upgrading my Qt_RealtimeIO_App test program to run on the latest Qt 5.2 on Windows 7, Linux and Mac OSX, I decided to test the application on all the different hardware I had access to. For testing on Linux I used the Knoppix 7.2.0 64-bit DVD because I don’t normally have my systems setup for dual boot. Knoppix includes Qt 4.8 on the DVD so this is reasonably easy even if you need to use command line tools.

Running under Mac or Windows 7, I would normally expect to see something like this on a lightly loaded system:

Figure 1: the program running as root in QTimer mode on an Intel i7 2.8 GHz iMac, OSX 10.9.3.


Figure 2: running as Administrator in QTimer mode on the ASUS i7-4930K 3.4 GHz extreme, Win 7 64-bit.


Figure 3: running as Administrator in win32 periodic timer mode on the ASUS i7-4930K 3.4 GHz extreme, Win 7 64-bit.

Running as a normal user on OSX or Win 7 will give quite worse results because you won’t get access to the true Time Critical thread level. Even running as root or administrator can show much higher delays if you start loading other programs and running them. I wasn’t doing anything with the GUI while these tests were running.

Next, let’s have a look at the ASUS i7 system running Knoppix 7.2.0 with a heavy load. For this test I will run:

  • Qt_RealtimeIO_App as root using QTimer mode at a 1 ms period.
  • Qt_SQL_App at user level continuously reading records from a database.
  • Qt_TCP_ClientServerApp at user level running full duplex with another Win 7 PC filling a Gigabit pipe to almost the 100% level in both directions.
  • A web browser running and surfing several pages.


Figure 4: the program running as root in QTimer mode on the ASUS i7-4930K 3.4 GHz extreme, Knoppix 7.2.0 64-bit.

Well, isn’t that interesting? Rock solid using a 1 ms QTimer even with all that extra activity. It’s quite amazing the the Linux scheduler is able to keep the realtime thread running at an accuracy of better than 100 microseconds. Now to test the Real-Time-Clock timer.


Figure 5: the program running as root in RTC mode on the ASUS i7-4930K 3.4 GHz extreme, Knoppix 7.2.0 64-bit.

Even the Real-Time-Clock provided similar accuracy, although I slowed the period down to 4 milliseconds. The RTC is a test function that is sometimes enabled in the Linux kernel. It generates interrupts off the RTC at power of 2 ms rates (1, 2, 4, 8, …) and allows you to perform a wait operation on each interrupt. I would not recommend using the RTC in any production system because it can be unreliable. I personally used the RTC interrupt with my own hand crafted RTOS back in the 90’s to run real-time operations at fairly high rates on the 386 systems of the time, and that was in protected mode using Borland Pascal 6.0 on DOS. Those systems proved to be very reliable, but more modern hardware doesn’t use the same RTC ICs as back then, thus the reliability problems.

Finally, let’s have a look at Knoppix on the older embedded motherboard running a 2nd generation i7.

Figure 5: the program running as root in QTimer mode on i7-2600 3.4 GHz, Q67 chipset, Knoppix 7.2.0 64-bit.

Quite a bit of extra latency is present on this system but still much better than Win 7 on the same hardware (not shown).

Conclusions

It is seen that Knoppix Linux running on the latest 4th generation i7 extreme hardware provides very accurate task scheduling. When compared to Win 7 on the same hardware, it provides superior performance. Running both Knoppix and Win 7 on a 2nd generation i7 system showed much worse performance. What could be causing this difference?

  • The i7 processors run at the same clock rate and should give similar performance.
  • The i7-4930K has 2 more cores than the i7-2600, not enough difference to greatly affect the results in my opinion.
  • The i7-4930K is 4th generation compared to the 2nd generation i7-2600. There could be some differences in instruction optimizations that could explain the difference.
  • The systems use different chipsets which could explain the difference.
  • There could have been processor features that were set differently between the systems, such as CPU sleep modes or the SpeedStep option. I believe they were configured in a similar mode, but I could have missed something.
  • The ASUS system used a SSD for the Win 7 OS, but Knoppix was running from the DVD drive and should not have been using the hard drive for any of the operations. I loaded the programs into the user documents folder which runs on a RAM disk.


What this test doesn’t prove:

  • Only one single thread was run and it didn’t do any useful work. Running multiple threads that run at different priority levels and make use of mutex locks could show very different results.
  • Either the Knoppix scheduler is very good or it has introduced some optimization that I don’t know about that works better on newer hardware.


You are free to download these programs and run similar tests on your own hardware to draw your own conclusions. It’s always possible I messed something up in these tests, but I’m very impressed with the difference I have seen.

Last Word

When choosing a system to run your soft real-time solutions, it is always best to write some test programs and kick the tires on several designs to see how much play there is in the scheduler steering.

© James S. Gibbons 1987-2015