40
CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Embed Size (px)

Citation preview

Page 1: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

CS4730Real-Time Systems and Modeling

Fall 2010

José M. Garrido

Department of Computer Science & Information Systems

Kennesaw State University

Page 2: CS4730 Real-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

Page 3: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Environment

The environment is connected to the computer system through:

• Sensors

• Actuators

• Other I/O devices

Fall 2010 (C) J M Garrido 3

Page 4: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 4

General Architecture of A Real-Time System

Page 5: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 5

Real-Time System

Page 6: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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

Page 7: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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.

Page 8: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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

Page 9: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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

Page 10: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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

Page 11: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 11

Embedded Real Time System

Page 12: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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.

Page 13: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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.

Page 14: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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

Page 15: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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.

Page 16: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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

Page 17: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

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

Page 18: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 18

Timeliness Issues

The goal is to reduce two specific time 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

Page 19: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Timeliness Issues

• 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

Page 20: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Deadline

• The most common type of timing constraint

• It is the absolute latest time that a computation must complete

Fall 2010 (C) J M Garrido 20

Page 21: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

General Properties of RTS

• Safety property

• Progress or liveness property

Fall 2010 (C) J M Garrido 21

Page 22: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 22

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

Page 23: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 23

Progress or Liveness Properties

• These describe the required “live” and desirable behavior of a system

• For example, in the Train-Gate System, the gate should be open whenever there are no trains in the area

Page 24: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 24

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.

Page 25: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 25

Major Subsystems

• 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 RT system may be in one of several states

Page 26: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 26

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.

Page 27: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 27

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

Page 28: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 28

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

Page 29: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 29

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.

Page 30: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 30

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.

Page 31: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 31

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 defined by:– synchronization– communication

Page 32: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 32

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 can used to describe this.

Page 33: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 33

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

Page 34: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 34

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.

Page 35: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 35

Types of Processes in RTS

Real-time systems contain two general types of processes:

• 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 event-driven and activated by an external signal, or change in some relationship

Page 36: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 36

Periodic Process

• A periodic process is characterized by a triple (c,p,d).

• The computation time interval is denoted by c

• The period or cycle time is denoted by p

• The deadline interval is denoted by d

• The first important relationship is:

c d p.

Page 37: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 37

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

• The minimum time interval between events is p

Page 38: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 38

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.

Page 39: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 39

Performance Measures for RTS

• Latency

• Number of deadlines missed

• Worst case reaction time

Page 40: CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University

Fall 2010 (C) J M Garrido 40

General RTS Approach