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:
- What are the essentials of real-time distributed systems?
- Software Patching at a Billion Miles -- Often real-time systems are also safety/mission-critical and the requirements and approaches bleed together.
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
- POSIX Real-Time Extensions — IEEE 1003.1b-1993 and 1003.1i-1995; Described at unix.org
- Ada Real-Time spec; the excellent rationale document.
- US DoD Network Centric Enterprise Solutions for Interoperability (NESI) Part 4: Node Guidance, Node Computing Infrastructure, Time-Critical Operations (P1395)
- The Real-Time Specification for Java (RTSJ) — See also the StackOverflow rtsj and real-time-java tags.
Implementation / Platforms
This section will summarize language, operating systems, middleware, and other implementation components common in RT systems.
- What languages are used for real-time systems programming?
- Real-Time Linux — Community sponsored efforts such as PREEMPT_RT as well as commercial providers such as Concurrent's RedHawk Linux