Questions tagged [real-time]

A task is real-time when the timeliness of the activities' completion is a functional requirement and correctness condition, rather than merely a performance metric. A real-time system is one where some (though perhaps not all) of the tasks are real-time tasks. DO NOT USE THIS TAG if all you mean is 'real-world'.

Definition

A task is real-time when the timeliness of the activities' completion is a functional requirement and correctness condition, rather than merely a performance metric. A real-time system is one where some (though perhaps not all) of the tasks are real-time tasks.

Real-time Systems

The term real-time is used in at least two distinct ways when referring to computer systems:

  • In the academic sense of real-time, a program or system is "real-time" when it is subject to execution time constraints, such as deadlines. Such systems are broken down into soft and hard real-time. Correctness of an implementation depends not only on the values produced by the program, but on the time at which those values are produced.

    • Hard real-time systems are those in which no deviation from the time constraints (e.g., missed deadlines) are tolerable, and any failure constitutes a complete failure of the system.
    • Soft real-time systems tolerate some degree of deviation from the time constraints, for example media streaming systems, in which some late packets may degrade the quality transiently, but still produce an acceptable execution.
  • As a synonym for "on-line", wherein the program must respond to events "in real-time", whether or not there is an actual time constraint involved. (e.g., real-time stock quotes or whatever.)

Wikipedia has a useful discussion.

Determinism

Some contributors, particularly in the defense and aerospace community, use terms like time-critical or dynamic time-critical instead, to denote systems that have real time constraints. The term real-time is sometimes problematic because it implies determinism (which is not always required or even desired) and it also has the baggage of some very specific theory and implementation history. Nevertheless, there exist highly dynamic systems which nevertheless have time constraints, and a great deal of engineering time is spent using a combination of hard and soft real-time approaches and custom hacks to meet those requirements.

If I have a system with well-defined tasks, and I want to say that task X must complete by time t with probability 0.95, is that a hard or a soft real-time task?

Composition of Tasks

Note that many real-time systems are composite, consisting of tasks and activities requiring varying degrees of timeliness predictability.

Foundations

Here are some foundational questions on StackOverflow and other resources to help understand the concepts of real-time:

Resource Management

Ensuring that activities in a real-time system typically rests in characterizing the activities' resource demands and then managing resources to satisfy them.

Characterization of resource demands usually includes at least an execution time analysis. A common measure is Worst Case Execution Time (WCET), typically given by a combination of empirical data and analysis. In addition, it is often necessary to capture other resource demands like I/O or "logical" resources like locks/mutexes/semaphores. A common metric in this dimension is blocking factor.

Once the activities have been characterized, explicit disciplines are employed to ensure timeliness. Historically, this has been done entirely manually, for instance by employing a cyclic executive design pattern. If the system is constructed atop a multi-process or multi-threaded platform, scheduling and synchronization disciplines must be used. The most common type of scheduler in RTOS is a priority scheduler, in which ready activities receive CPU time in order of their expressed priority. While most real-time activities' time constraints are articulated in terms of deadlines, few or no RTOS provide an explicit deadline scheduler. Instead, periodic or sporadic activities with deterministic deadlines are assigned priorities using Rate Monotonic Analysis (RMA) to map them onto fixed priorities.

Standards

Implementation / Platforms

This section will summarize language, operating systems, middleware, and other implementation components common in RT systems.

Examples

FAQs

4560 questions
41
votes
1 answer

How do you write a real-time webbased collaboration tool such as google docs?

I'm really curious about How one would go about writting a collaboration tools such as google docs? The closest thing that I can think of is to write a messaging system like a chat and then send messages back and forth so that each client updates…
elviejo79
  • 4,592
  • 2
  • 32
  • 35
39
votes
8 answers

Is there a way to 'listen' for a database event and update a page in real time?

I'm looking for a way to create a simple HTML table that can be updated in real-time upon a database change event; specifically a new record added. In other words, think of it like an executive dashboard. If a sale is made and a new line is added…
AngeloS
  • 5,536
  • 7
  • 40
  • 58
36
votes
1 answer

Android - Losing incoming (hi-speed) USB data

When using Android, I'm losing data on an incoming USB data stream that I do not lose when reading the same device/stream in Windows. (I know that Android is not a real-time OS, but neither is Windows, and Windows is having no problem 'keeping up'…
Greg
  • 839
  • 8
  • 8
36
votes
3 answers

socket.io determine if a user is online or offline

We can trace if a connection is established or disconnected by this code console.log('a user connected'); socket.on('disconnect', function () { console.log('user disconnected'); }); Well, its fine. But how can we determine what user…
Shahid Karimi
  • 4,096
  • 17
  • 62
  • 104
36
votes
5 answers

Real-time audio processing in Android

I'm trying to figure out how to write an app that can decode audio morse code on the fly. I found this document which explains how to record audio from the microphone in Android. What I'd like to know is whether it's possible to access the raw input…
Jeremy Logan
  • 47,151
  • 38
  • 123
  • 143
36
votes
1 answer

Real time line graph with nvd3.js

I am trying to create a real time graph using nvd3.js which would be updated periodically and with the impression that the data is processed in real time. For now I have been able to create a function which would update the graph periodically but I…
Christopher Chiche
  • 15,075
  • 9
  • 59
  • 98
36
votes
3 answers

How do real time updates work?

Now a days real time updates are common in most popular sites which have heavy usages. StackExchange Facebook Twitter I'm wondering how do these "real time updates" work? I'm just looking for a general bird's view perspective. I suspect that the…
Anthony
  • 33,838
  • 42
  • 169
  • 278
34
votes
4 answers

Are there free realtime financial data feeds since the demise of OpenQuant?

Now that the oligopole of market data providers successfully killed OpenQuant, does any alternative to proprietary and expensive subscriptions for realtime market data subsist? Ideally I would like to be able to monitor tick by tick securities from…
Mel Cooper
  • 349
  • 1
  • 4
  • 3
33
votes
30 answers

What's the best alternative to C++ for real-time graphics programming?

C++ just sucks too much of my time by making me micro-manage my own memory, making me type far too much (hello std::vector::const_iterator it = lotsOfThingys.begin()), and boring me with long compile times. What's the single best…
Baxissimo
  • 2,629
  • 2
  • 25
  • 23
33
votes
5 answers

Software patching at a billion miles

Could someone here shed some light about how NASA goes about designing their spacecraft architecture to ensure that they are able to patch bugs in the deployed code? I have never built any “real time” type systems and this is a question that has…
Maxim Gershkovich
  • 45,951
  • 44
  • 147
  • 243
32
votes
4 answers

Playing back sound coming from microphone in real-time

I've been trying to get my application recording the sound coming from the microphone and playing it back in (approximately) real-time, however without success. I'm using AudioRecord and AudioTrack classes for record and playback, respectively. I've…
Jonny
  • 321
  • 1
  • 3
  • 3
32
votes
15 answers

Performance of C++ vs Virtual Machine languages in high frequency finance

I thought the C/C++ vs C#/Java performance question was well trodden, meaning that I'd read enough evidence to suggest that the VM languages are not necessarily any slower than the "close-to-silicon" languages. Mostly because the JIT compiler can do…
Carlos
  • 5,991
  • 6
  • 43
  • 82
31
votes
2 answers

What are the essentials of real-time distributed systems?

I am getting my foot into contracting and have had today my first round interview for a contractor position. I have passed it however I was told - being mainly a UI developer - I only covered the basics of what they needed for their backend, and I…
Houman
  • 64,245
  • 87
  • 278
  • 460
31
votes
7 answers

Is a garbage collector (.net/java) an issue for real-time systems?

When building a system which needs to respond very consistently and fast, is having a garbage collector a potential problem? I remember horror stories from years ago where the typical example always was an action game where your character would stop…
Toad
  • 15,593
  • 16
  • 82
  • 128
31
votes
4 answers

Whats are some real time data sources?

I'm working on a demo on real-time visualization and I'm trying to think out of the box. Looks like any big data real-time demo is on twitter or traffic data. Are there any other options out there that publish real-time data (for free)? Thanks
webber
  • 1,834
  • 5
  • 24
  • 56