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

4299 questions
29
votes
2 answers

Get Real Time - Not Device Set Time in android

How to find out the Real Geographical Time, as in my application I want to attach the real time with my application. So that if the user changes the time in his device then I should get only the real prevailing time - NOT THE DEVICE TIME My question…
Dwivedi Ji
  • 7,725
  • 5
  • 55
  • 76
29
votes
4 answers

How "Real-Time" is Linux 2.6?

I am looking at moving my product from an RTOS to embedded Linux. I don't have many real-time requirements, and the few RT requirements I have are on the order of 10s of milliseconds. Can someone point me to a reference that will tell me how…
Robert
  • 11,820
  • 19
  • 61
  • 85
28
votes
3 answers

Single producer, single consumer data structure with double buffer in C++

I have an application at $work where I have to move between two real-time threads that are scheduled at different frequencies. (The actual scheduling is beyond my control.) The application is hard real-time-ish (one of the threads has to drive a…
27
votes
7 answers

How frequent is DateTime.Now updated ? or is there a more precise API to get the current time?

I have code running in a loop and it's saving state based on the current time. Sometimes this can be just milliseconds apart, but for some reason it seems that DateTime.Now will always return values of at least 10 ms apart even if it's only 2 or 3…
Jamie C
27
votes
3 answers

How to detect significant change / trend in a time series data?

So I have an array of say 25 samples and I would want to be able to note the trends of whether it's decreasing n or increasing from those 25 sample time interval(basically 25 samples array is my buffer that is being filled by every say 1 ms). Note…
as3rdaccount
  • 3,473
  • 8
  • 35
  • 57
26
votes
3 answers

Performance impact of virtual inheritance

I am considering using virtual inheritance in a real-time application. Does using virtual inheritance have a performance impact similar to that of calling a virtual function? The objects in question would only be created at start up but I'm…
Graeme
  • 4,166
  • 2
  • 37
  • 64
25
votes
10 answers

What languages are used for real time systems programming?

I didn't find any useful information about programming languages for real time systems. All I found was Real Time Systems and Programming Languages: Ada 95, Real-Time Java and Real-Time C/POSIX (some pdf here), which seems to talk about extensions…
eKek0
  • 21,835
  • 24
  • 87
  • 117
25
votes
5 answers

using C# for real time applications

Can C# be used for developing a real-time application that involves taking input from web cam continuously and processing the input?
nishant
  • 2,383
  • 6
  • 35
  • 44
25
votes
9 answers

Is there a better C?

I want a better C. Let me explain: I do a lot of programming in C, which is required for applications that have real-time needs such as audio programming, robotics, device drivers, etc. While I love C, one thing that gets on my nerves after having…
Steve
  • 1,452
  • 1
  • 13
  • 17
25
votes
5 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,523
  • 4
  • 21
  • 46
24
votes
1 answer

How to reduce jitter for Java?

To resolve this issue I have created an open source Java Thread Affinity library When I have a number of thread interacting closely it can reduce latency and increase throughput. For single threaded tasks it can still reduce jitter quite a…
Peter Lawrey
  • 498,481
  • 72
  • 700
  • 1,075
24
votes
5 answers

On the use and abuse of alloca

I am working on a soft-realtime event processing system. I would like to minimise as many calls in my code that have non-deterministic timing. I need to construct a message that consists of strings, numbers, timestamps and GUID's. Probably a…
24
votes
4 answers

How does Minecraft perform lighting?

The only model I'm familiar with is diffuse lighting but this look way more complicated than that.
Xavier
  • 7,987
  • 13
  • 61
  • 93
24
votes
3 answers

How about Haskell's GC performance for soft realtime application like games?

Because I realized game rule logic should handle huge complexity, I'm considering using of non-typical language in game field as in-game logic script language. The reason of in-game script is representing complex logic with less code. So extremely…
eonil
  • 75,400
  • 74
  • 294
  • 482
24
votes
2 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
  • 3,721
  • 17
  • 55
  • 94