Real Time Programming: Myths and Reality

The term “real time” has become a buzzword, as in “real time stock quotes” or “real time database queries”. However, neither a database-oriented system nor a NYSE stock ticker running on your desktop is truly a real time application. As opposed to a common belief, “real time” doesn’t mean “fast response time” or “low latency”; rather, it means, among other things, a totally deterministic operation mode.

For example, if you execute the same database query twice, each time it will take a different amount of time to execute, depending on various extraneous factors such as the number of users currently connected to the database, system load, the distance of the disk sector that contains the database records from the read/write magnetic head, the size of available memory etc. In other words, the response time of a database query is not deterministic, and hence it’s not a real time operation.

On the other hand, a cellular phone must operate in real time mode: the chipset that receives the airborne digital signals must demodulate, filter, and correct these signals within a fixed amount of time, every time. Not some of the time, or most of the time, but every time. Note that even a millisecond delay is unacceptable in this case: the digital signals keep coming in. If they are not processed on their allotted time slice, they are simply overrun by more incoming signals (think of a Web-based media player that skips frames when displaying a video clip). To conclude, real time essentially means a totally deterministic performance all the time, regardless of extraneous factors such as the number of users, available free memory etc.

Many programming languages are unsuitable for real time programming due to their non-deterministic nature. For example, languages that have a built-in garbage collector are very problematic because the garbage collector might “wake up” at the wrong moment, halting all other operations until it finishes. A real time software application that controls the amount of fuel supplied to an airplane’s engine at lift off cannot be interrupted by a garbage collector, not even momentarily.

The designers of C++ deliberately refrained from adding to it features that would disqualify it from being used in real time applications. Indeed, not every feature in C++ is deterministic: dynamic memory allocation is not a deterministic operation because extraneous factors such as heap fragmentation affect its performance. Operator dynamic_cast is not deterministic either. However, unlike other languages, C++ doesn’t force these features on you (see also, so if your application must operate in real time mode, you can avoid such features, thereby ensuring a deterministic operation.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may