CS4730Real-Time Systems and Modeling
Fall 2010
José M. Garrido
Department of Computer Science & Information Systems
Kennesaw State University
Fall 2010 (C) J M Garrido 2
Real-Time Systems
RTS are computer systems that
• monitor,
• respond to, or
• control an external environment
Environment
The environment is connected to the computer system through:
• Sensors
• Actuators
• Other I/O devices
Fall 2010 (C) J M Garrido 3
Fall 2010 (C) J M Garrido 4
General Architecture of A Real-Time System
Fall 2010 (C) J M Garrido 5
Real-Time System
Fall 2010 (C) J M Garrido 6
Constraints
• A real-time system must meet various timing and other constraints imposed by the real-time behavior of the environment
• A real-time system is also called a reactive system because it must respond to or react to signals from the environment
Fall 2010 (C) J M Garrido 7
Real-Time Systems
• A reactive system that maintains an on-going interaction with its environment, and with given time windows for its output
• Includes a combination of hardware and software
• There is a wide variety of RTS – small embedded systems– very large systems on WANs.
Fall 2010 (C) J M Garrido 8
Examples of RTS
• Vehicle systems for automobile, subways, aircraft, railways, ships, …
• Traffic control
• Process control for power plants, chemical plants, …
• Medical systems
• Military applications
• Manufacturing systems with robots
Fall 2010 (C) J M Garrido 9
Examples of RTS (Cont.)
• Communication systems
• Computer games
• Multimedia systems that provide text, graphic, audio, and video interfaces
• Consumer appliances
Fall 2010 (C) J M Garrido 10
Embedded Systems
• A real-time system that is part of another larger system
• Does not usually interact with humans users or operators
• Interfaces directly with sensors and actuators
• Very specialized to suit a specific purpose
• The software is usually implemented in firmware
Fall 2010 (C) J M Garrido 11
Embedded Real Time System
Fall 2010 (C) J M Garrido 12
Categories of Real_time Systems
Different systems will have different requirements for meeting deadlines:
• Hard real-time systems - missing even a single deadline is considered unacceptable, e.g., The new U.S. Air Traffic Control System.
• Soft real-time systems - missing a deadline occasionally is considered acceptable, e.g., telephony systems.
Fall 2010 (C) J M Garrido 13
Real-Time Systems
General characteristics:• Reactive, the system must respond timely to
internal and external input events
• Concurrent, the system needs to manage several tasks (or processes)
• Each task has timing constraints, i.e., it has to respond in a timely fashion.
Fall 2010 (C) J M Garrido 14
Other Major Characteristics
• Reliability - a measure of how often a system will fail. Also stated as the probability that a system will perform correctly for a given period
• Fault tolerance - recognition and handling of failures. Avoidance of failures is important, but responding appropriately to failures is challenging
Fall 2010 (C) J M Garrido 15
Criticality
• A measure of the failure cost. The higher the cost of failure, the more critical the system.
• A critical system might control an aircraft or a nuclear power plant
• A RTS might be a hard system, even though it is not a critical one. For example, a computer game.
Fall 2010 (C) J M Garrido 16
Architecture of Real-Time Systems
• Hardware components– used to interact with the environment– consists of sensors and actuators
• Software components– controls the actions of the hardware– computations
Fall 2010 (C) J M Garrido 17
Properties of Real-Time Systems
• Timeliness - the system must perform operations in timely manner
• Reactiveness - the system continuously responds to (random) events
• Concurrency - multiple simultaneous activities are carried out
• Distribution - tasks cooperate in multiple computing sites
Fall 2010 (C) J M Garrido 18
Timeliness Issues• The goal is to reduce two specific intervals:
– service time - the interval taken to compute a response to a given input
– latency - the interval between the time of occurrence of an input and the time at which it starts being serviced
• The sum of these two intervals represents the response time. This must be shorter than the deadline for this type of input.
Fall 2010 (C) J M Garrido 19
Safety Properties
• The system should never be in certain (undesirable) states
• “The system should not do bad things”
• In the Train-gate System, the gate should never be open when a train is in the intersection area
Fall 2010 (C) J M Garrido 20
Progress or Liveness Properties
• These describe the required “live” and desirable behaviors of a system
• For example, in the Train-Gate System, the gate should be open whenever there are no trains in the area
Fall 2010 (C) J M Garrido 21
Techniques for Studying RT Systems
The techniques for dealing with timeliness problems belong to two main groups:
• Analytic techniques - use formal mathematical models of the systems and mathematical techniques
• Simulation - use computer models to compute behavior characteristics.
Fall 2010 (C) J M Garrido 22
Basic Elements in Behavior
• Events, are instantaneous occurrences that trigger transitions and operations on some objects. Events can be external or internal.
• States, represent a unique behavior with respect to the other states in an object. An event or message can cause a change of state.
• Transitions are state changes in the objects.
Fall 2010 (C) J M Garrido 23
Process and States
• In a high-level view, a RTS is considered a closed world containing two components: an environment and a computer system
• These components interact via messages, signals, or events at their interface
• At any time, the system may be in one of several states
Fall 2010 (C) J M Garrido 24
States
• Each state denotes a particular set of values of variables or set of relations among variables
• The system changes state due to events that change the values of, or relations among, these state variables
• These state changes are called transitions
Fall 2010 (C) J M Garrido 25
Model of RTS
• The software that implement RT systems deal with states, and transitions and a set of interacting processes
• Processes interact by – sending messages and signals to each other– sharing hardware and software– competing for resources
• A process is an active component (object) of a RTS
Fall 2010 (C) J M Garrido 26
Reactiveness Issues
• Transformational systems - some initial data is transformed by a series of computations into the desired output data, then the system terminates
• Reactive systems - are involved in a continuous interaction with the environment, these systems do not terminate.
Fall 2010 (C) J M Garrido 27
Nondeterminism
• In general, real-time systems are non-deterministic systems since they have no control over the relative order or time of occurrence of input events.
• This characteristic is a reflection of the unpredictable nature of the real-world in which such systems operate.
Fall 2010 (C) J M Garrido 28
Concurrency Issues
• A task is a sequential thread of control, a system with concurrency contains two or more simultaneous threads of control that dynamically interact
• Threads may progress at different speeds, their interactions can be:– synchronization– communication
Fall 2010 (C) J M Garrido 29
Communication
The communication of tasks in real-time systems can be:
• Synchronous - a direct communication between two tasks. Both the sender task and the receiver task have to be ready
• Asynchronous - an indirect communication that uses mailboxes.
UML Sequence diagrams are used to describe this.
Fall 2010 (C) J M Garrido 30
Distribution Issues
• Consists of a set of computing sites loosely coupled through a communication network
• Message loss is just one of a collection of truly difficult problems facing designers of distribution systems
Fall 2010 (C) J M Garrido 31
Active and Passive Agents
• Active agents are the major components of a system with their own thread of control
• Passive agents only “executes” when one of its operations is invoked - it is only active during interactions with other objects
• Design and programming with agents involves constructing “machines” and interconnecting them.
Fall 2010 (C) J M Garrido 32
Types of Processes in RTS
• Periodic processes - are activated in a regular basis between fixed time intervals. Used for systematically monitoring, polling, or sampling data from sensors
• Sporadic processes - are activated by an external signal, i.e., are event-driven.
Fall 2010 (C) J M Garrido 33
Periodic Process
• A periodic process is characterized by a triple (c,p,d).
• The computation period is denoted by c
• The period or cycle time is denoted by p
• The deadline is denoted by d
• The first important relationship is:
c d p.
Fall 2010 (C) J M Garrido 34
Sporadic Process
• A sporadic process is also characterized by a triple (c,p,d), with c d p.
• On the occurrence of the event, the computation must be completed within the specified deadline. The completion time t must satisfy:
t te + d
te is the event occurrence time
Fall 2010 (C) J M Garrido 35
Further Timing Effects
• The interactions among processes further add more delays in the computation times of the processes
• Another effect is jitter. This is the variation from cycle to cycle, or from event to event, of the time to complete a task.
Fall 2010 (C) J M Garrido 36
Performance Measures for RTS
• Latency
• Number of deadlines missed
• Worst case reaction time
Fall 2010 (C) J M Garrido 37
General RTS Approach