basic real time concepts systems concepts real-time definitions events and determinism cpu...

21
Basic Real Time Concepts Systems Concepts Real-Time Definitions Events and Determinism CPU Utilization Real-Time System Design Issues Example Real-Time Systems Common Misconceptions

Upload: daniela-baker

Post on 18-Dec-2015

234 views

Category:

Documents


0 download

TRANSCRIPT

Basic Real Time Concepts

Systems ConceptsReal-Time Definitions

Events and DeterminismCPU Utilization

Real-Time System Design IssuesExample Real-Time SystemsCommon Misconceptions

Systems Concepts• Definition: A system is a mapping of a set of inputs into a set of outputs.• When the internal details of the system are not of interest, the mapping

function can be considered as a black box

Real Time Ctrl System

• Note: that in its realization there is some delay between presentation of the inputs (stimulus) and appearance of the outputs (response). This fact can be formalized as follows:

• Definition: The time between the presentation of a set of inputs to a system (stimulus) and the realization of the required behavior response), including the availability of all associated outputs, is called the response time of the system.

• How fast the response time needs to be, depends on the purpose of the system.

Real-Time Definitions

• Definition: A real-time system is a system that must satisfy explicit (bounded) response-time constraints or risk severe consequences, including failure.

• Definition: A failed system is a system that cannot satisfy one or more of the requirements stipulated in the formal system specification.

• Definition: A real-time system is one whose logical correctness is based on both the correctness of the outputs and their timeliness.

When Is a System Real-Time?• It can be argued that all practical systems are real-time systems. Even a

batch-oriented system – for example, grade processing at the end of a semester or a bimonthly payroll run – is real-time. Although the system may have response times of days or weeks (e.g., the time that elapses between submitting the grade or payroll information and issuance of the report card or check), it must respond within a certain time or there could be an academic or financial disaster. Even a word-processing program should respond to commands within a reasonable amount of time (e.g., 1 second), or it will become torturous to use. Most of the literature refers to such systems as soft real-time systems.

• Definition: A soft real-time system is one in which performance is degraded but not destroyed by failure to meet response-time constraints.

Cont ….

• Definition: A hard real-time system is one in which failure to meet a single deadline may lead to complete and catastrophic system failure.

• Definition: A firm real-time system is one in which a few missed deadlines will not lead to total failure, but missing more than a few may lead to complete and catastrophic system failure.

Ilustration of Different Types of RTS

The Nature of Time

• Deadlines are instants in time. But the question arises, “Where do the deadlines come from?”– Based on the underlying physical phenomena of the

system under control.

• For example, in animated displays, images must be updated at approximately 30 frames per second to provide continuous motion, because the human eye can resolve updating at a slower rate.

Events and Determinism• In software systems, a change in state results in a

change in the flow-of-control of the computer program. • In flow chart, the decision block represented by the

diamond suggests that the stream of program instructions, can take one of two paths, depending on the response in question. if-then, goto, and case statements in any language represent a possible change in flow-of-control.

• Invocation of procedures in C and Ada represent changes inflow-of-control. In object-oriented languages, instantiation of an object or the invocation of a method causes the change in sequential flow-of-control. In general, consider the following definition.

Cont…

• Definition: Any occurrence that causes the program counter to change non-sequentially is considered a change of flow-of-control, and thus an event.

• Definition: The release time is the time at which an instance of a scheduled task is ready to run, and is generally associated with an interrupt. (application wise)

• Events are slightly different from jobs in that events can be caused by interrupts as well as conditional and unconditional branches.

Synchronous and Asynchronous Events

• An event can be either synchronous or asynchronous.

• Synchronous events are those that occur at predictable times in the flow-of-control, such as that represented by the decision box in flow chart.

• Asynchronous events occur at unpredictable points in the flow-of-control and are usually caused by external sources.

Aperiodic - Irregular Interval

• Aperiodic events that tend to occur very infrequently are called sporadic.

• For example, an interrupt generated by a periodic external clock represents a periodic but asynchronous event.

• A periodic but synchronous event is one represented by a sequence of invocation of tasks in a repeated, circular fashion, otherwise known as cyclic code.

• A typical conditional or unconditional branching instruction2 that is not part of a code block and that runs repeatedly at a regular rate represents a synchronous but aperiodic event.

• A branch instruction that happens infrequently, say, on the detection of some exceptional condition, is both sporadic and synchronous.

• Finally, interrupts that are generated irregularly (randomly) by an external device are classified as either asynchronous aperiodic or sporadic, depending on whether the interrupt is generated frequently or not with respect to the system clock.

Mapping Them

Determinism

• For any physical system certain states exist under which the system is considered to be out of control; the software controlling such a system must therefore avoid these states.

• the next state of the system, given the current state and a set of inputs, must predictable.

• In other words, the goal is to anticipate how a system will behave in all possible circumstances

Deterministic Behavior

• Definition: A system is deterministic if, for each possible state and each set of inputs, a unique set of outputs and next state of the system can be determined.

• Finally, if in a deterministic system the response time for each set of outputs is known, then, the system also exhibits temporal determinism.

• A side benefit of designing deterministic systems is that guarantees can be given that the system will be able to respond at any time, and in the case of temporally deterministic systems, when they will respond. This reinforces the association of control with real-time systems.

CPU Utilization

The final and most important term to be defined is a critical measure of real-time system performance. Because in the von Neumann paradigm, the CPU continues to fetch, decode, and execute instructions as long as power is applied, the CPU will execute either no-ops or instructions or instructions that are not related to the satisfaction of a deadline (for example, noncritical “housekeeping”). The measure of the time spent doing idle processing, in a sense, indicates how much real-time processing is occurring.

CPU Util…. defn

• Definition: The (CPU) utilization or time-loading factor, U, is a measure of the percentage of nonidle processing.

• A system is said to be time-overloaded if – U >100%.

REAL-TIME SYSTEM DESIGN ISSUES