Real Time Programming: Myths and Reality

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 www.research.att.com/~bs/esc99.html), so if your application must operate in real time mode, you can avoid such features, thereby ensuring a deterministic operation.

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as