1_drss_sak5308_w01_2011

Upload: nurul-huda-muhammad-nasir

Post on 06-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 1_drss_SAK5308_W01_2011

    1/41

    Dr Shamala Subramaniam 1

    Real-Time SystemsDr Shamala SubramaniamDept. Communication Technology & Networks

    Faculty of Computer Science & IT, UPM

    e-mail : [email protected] : 03-89466512

  • 8/3/2019 1_drss_SAK5308_W01_2011

    2/41

    Dr Shamala Subramaniam 2

    Synopsis

  • 8/3/2019 1_drss_SAK5308_W01_2011

    3/41

    Dr Shamala Subramaniam 3

    Real-Time SystemsDr Shamala SubramaniamDept. Communication Technology & Networks

    Faculty of Computer Science & IT, UPM

    e-mail : [email protected] : 03-89466512

  • 8/3/2019 1_drss_SAK5308_W01_2011

    4/41

  • 8/3/2019 1_drss_SAK5308_W01_2011

    5/41

    Dr Shamala Subramaniam 5

    Definition

    Any system where a timely response by the

    computer to external stimuli is vital is a real-

    time system.

    The statement is True

    because it is almost

    Content Free

    Real-Time Systemruns

    task that have deadlines

    Not necessary for the task to done within the

    dateline

    aircraft vs. video game

    What do you do with a real-

    time tasks that misses its

    deadline?

    Done Not necessarily to be done ,

    calculating the value ofT vs. accounts

  • 8/3/2019 1_drss_SAK5308_W01_2011

    6/41

    Dr Shamala Subramaniam 6

    Definition A real-time system is one which a substantial

    fraction of the design effort goes into makingsure that task deadlines are met.

    Oxford Dictionary of Computing Any system in which the time at which the output

    is produced is significant. This is usually becausethe input corresponds to some movement in thephysical world, and the output has to relate to thesame movement. The lag from the input to theoutput must be sufficiently small for acceptabletimeliness.

    Young (1982) Any information processing activity or system

    which has to respond to externally generated inputstimuli within a finite and specified period.

  • 8/3/2019 1_drss_SAK5308_W01_2011

    7/41

    Dr Shamala Subramaniam 7

    Hard versus Soft

    HARD: miss a deadline and youre in trouble! (planes, trains,factory control, nuclear facilities, ...)

    SOFT: try to meet deadlines, but if not, system still works,although with degraded performance (multimedia, thermostat,...)

    FIRM: late results are worthless (deadlines can be missedoccasionally), but you are not in trouble (no benefit from latedelivery)

  • 8/3/2019 1_drss_SAK5308_W01_2011

    8/41

    Dr Shamala Subramaniam 8

    Driving a Car

    Relating to a Real-Time System

  • 8/3/2019 1_drss_SAK5308_W01_2011

    9/41

    Dr Shamala Subramaniam 9

    Example: Car-and-DriverDrivers Mission: Reaching the destination safely whilesatisfying the constraints.

    Controlled System/Process: Car.

    Operating environment: Road conditions and other cars.

    Controlling SystemHuman driver:Sensors - Eyes and Ears of the driver.(Real-time Controller)Computer:

    Sensors - Cameras, Infrared receiver, and Laser telemeter.

    Controls: Accelerator, Steering wheel, Break-pedal.

    Actuators: Wheels, Engines, and Brakes.

    Constraintsof the driver

    Reachdestinationwithout

    colliding andwithin thespeed limit

  • 8/3/2019 1_drss_SAK5308_W01_2011

    10/41

    Dr Shamala Subramaniam 10

  • 8/3/2019 1_drss_SAK5308_W01_2011

    11/41

    Dr Shamala Subramaniam 11

    Quantifying the drivers performance

    Measure the outcome of the drivers actions, taken in

    context of the operating environment.

    1. Getting to the destination

    2. The Time taken to reach to

    the destination

    15mph (well?) during

    snowstorm and

    on a dry weather

    Not just the

    outcome but whatcaused the driver

    to get there

    (landing into a

    ditch)

    Obvious

    Outcomes

  • 8/3/2019 1_drss_SAK5308_W01_2011

    12/41

    Dr Shamala Subramaniam 12

    Performance is not an absolute commodity.

    Performance must be measured instead in

    terms of what the condition allows.

    In other words, performance measures the

    goodness of the outcome relative to the bestoutcome possible under the circumstances.

    Conclusion Performance

  • 8/3/2019 1_drss_SAK5308_W01_2011

    13/41

    Dr Shamala Subramaniam 13

    Critical Task Tuning the Radio vs. Steering

    and Braking

    Critical Task varying Deadlines Not Constant; they vary

    with the operating environment (driving 6pm/am).

    About the drivers condition:

    Drivers Physical Condition 1s sleep vs. micro-sleeping

    Discrimination - on the basis of secondary factors

    additional fuel consumption

    Performance (cont.):

    The task the driver must perform

  • 8/3/2019 1_drss_SAK5308_W01_2011

    14/41

    Dr Shamala Subramaniam 14

    Try Out !!

    Write a detail specification on what the driver must do ineach conceivable eventuality & then ensure that the

    specifications were complete.

  • 8/3/2019 1_drss_SAK5308_W01_2011

    15/41

    Dr Shamala Subramaniam 15

    Wouldnt you agree that:

    Writing out formal specifications and validating them areperhaps the most difficult task in real-time systems. They

    are also the tasks about which researchers know the least.

  • 8/3/2019 1_drss_SAK5308_W01_2011

    16/41

    Dr Shamala Subramaniam 16

    Issues in Real-Time Computing

    A real-time computer must be more reliable than its

    individual hardware and software components.

    It must be capable of working in : Harsh environments

    Rich in electromagnetic noise

    Elementary-particle radiation

    Face of rapidly changing computation loads.

    The field of real-time computing is especially rich in

    research problems.

  • 8/3/2019 1_drss_SAK5308_W01_2011

    17/41

    Dr Shamala Subramaniam 17

    Issues in Real-Time Computing (cont.)

    Task execution time Cache Example

    A executes B executes A executes

    t1T2.2

    A preempted by B A resumes A completes

    Real-Time Systems differs from general purpose counterparts in 2 ways:

    Much more specific in their applications

    Consequences of their failure are more drastic

  • 8/3/2019 1_drss_SAK5308_W01_2011

    18/41

    The Oracle in Delphi, GreeceThe Oracle in Delphi, Greece

  • 8/3/2019 1_drss_SAK5308_W01_2011

    19/41

    Since the consequences

    are severe Such systems need to be specified

    more carefully

    Their performance validated

    specification languages and

    performance measures capable of

    expressing timing requirements

    Example : jet engine x general purpose

    workstation

  • 8/3/2019 1_drss_SAK5308_W01_2011

    20/41

    Structure of A RealStructure of A Real--Time SystemTime System

    ControlledControlled

    ProcessProcess SensorsSensors Job ListJob List

    TriggerTrigger

    GeneratorGenerator

    ExecutionExecution

    DisplayDisplay

    ClockClock

    OperatorOperator

    ActuatorsActuators

    State of the controlledState of the controlledprocess and of theprocess and of theOperating EnvironmentOperating Environmentis acquired by sensorsis acquired by sensors

    EnvironmentEnvironmentProvides input to theProvides input to thecontroller, RT computercontroller, RT computer

    The s/w for the jobs areThe s/w for the jobs arepreloadedpreloaded schedulingscheduling

    used to triggerused to triggerthe execution ofthe execution ofindividual jobsindividual jobs

    can becan bepreloaded orpreloaded or

    pre=determinedpre=determined

    output ofoutput oftrigger is fed intrigger is fed inthe actuatorsthe actuatorsFaultFault--TolerantTolerant

    techniquestechniques

  • 8/3/2019 1_drss_SAK5308_W01_2011

    21/41

    Structure of A Real-Time System (cont.)

    The control computer exhibits dichotomy in terms of the

    data rates.

    Central clusterCentral clusterControlalgorithmsareexecutedControlalgorithmsareexecuted

    ProcessingofthedataProcessingofthedataintothenextstageintothenextstage

    MIDDLEMIDDLE

    Sensors,actuators,displaysandinputpanelsSensors,actuators,displaysandinputpanels

    LOW RATESLOW RATES

    Schematic decompositionofaSchematic decompositionofarealreal--time control computertime control computer

  • 8/3/2019 1_drss_SAK5308_W01_2011

    22/41

    TASK CLASSES

    Task can be classified in two ways:

    Predictability of their arrival

    Consequences of not being executed on time

    Periodic speed of the aircraft

    aperiodic aircraft turn

    Critical

    Non Critical

    - every ni iterations of critical periodtask i

    - the goal is to maximize no. of jobs

  • 8/3/2019 1_drss_SAK5308_W01_2011

    23/41

    More examples RT SystemMore examples RT System cars: engine control, ABS, drivecars: engine control, ABS, drive--byby--wirewire

    planes: stability, jet engine, flyplanes: stability, jet engine, fly--byby--wirewire

    computers: peripherals, applicationscomputers: peripherals, applications

    military: weapons, satellitesmilitary: weapons, satellites

    domestic: microwave, thermostat, dishwasherdomestic: microwave, thermostat, dishwasher

    medical: pacemaker, medical monitoringmedical: pacemaker, medical monitoring

    protection: intruder alarm, smoke/gasprotection: intruder alarm, smoke/gas

    detectiondetection

  • 8/3/2019 1_drss_SAK5308_W01_2011

    24/41

    Common MisconceptionsCommon Misconceptions real fast is real-time: a computer system may

    satisfy an applications requirement, but no

    predictability (no real-time resource management). hardware over-capacity is enough: again, without

    real-time resource management no appropriate

    balance of resource distribution.

  • 8/3/2019 1_drss_SAK5308_W01_2011

    25/41

    Issues in RealIssues in Real--Time ProgrammingTime Programming

    Performance MeasuresPerformance Measures

  • 8/3/2019 1_drss_SAK5308_W01_2011

    26/41

    Characterizing Real-Time

    Systems and Task

    Dr Shamala SubramaniamDept. Communication Technology & NetworksFaculty of Computer Science & IT

    Universiti Putra Malaysia43400 Serdang, Selangor

  • 8/3/2019 1_drss_SAK5308_W01_2011

    27/41

    Contents Performance measures for real-time systems

    Properties of Performance Measures

    Traditional Performance Measures

    Performability Cost Functions & Hard Deadlines

    Estimating Program Run Times Analysis of Source Code

    Accounting for Pipeline

    Caches

  • 8/3/2019 1_drss_SAK5308_W01_2011

    28/41

    Introduction

    2 Questions ?

    Which performance measures are

    the most appropriate for real-time

    systems?

    How can engineers estimate theworst-case run time of a program,

    given the source code and target

    architecture?

  • 8/3/2019 1_drss_SAK5308_W01_2011

    29/41

    Performance Measures for Real-Time

    SystemsReal-time systems are used for critical

    applications

    Thus, the system must be carefully :

    designed

    validated before operation

    Checking design correctnessusing formal and informal

    methods

    Characterizing performance &

    reliability

    Preparatory

    Step:

    The choice of

    performance

    measures

  • 8/3/2019 1_drss_SAK5308_W01_2011

    30/41

    Performance Measures

    The choice of performance measures iscrucial

    Are yardsticks by whichcharacterization is expressed

    Must be concise encapsulate in veryfew numbers the performance of asystem

    Analogy: Languages through which we convey

    system performance Natural languages determines how our thoughts

    gets expressed but also which ideas arise the

    richness of the vocabulary

  • 8/3/2019 1_drss_SAK5308_W01_2011

    31/41

    Performance Measures (cont.) Eg: System A and B have system response times with thepdf.

    Prob

    abilitydensity

  • 8/3/2019 1_drss_SAK5308_W01_2011

    32/41

    Performance Measures (cont.) Eg: System A and B have system : weighted sum of themean M and variance V of the response time

    a1M+

    a2(V)

  • 8/3/2019 1_drss_SAK5308_W01_2011

    33/41

  • 8/3/2019 1_drss_SAK5308_W01_2011

    34/41

    The mean is a measure of the center or most likely value ina distribution. For N samples

    x0, x1, x2,....xN-1from some population, the mean (also sometimes called the

    average orexpected value) is defined as

  • 8/3/2019 1_drss_SAK5308_W01_2011

    35/41

    The variance A measure of the average distance betweeneach of a set of data points and their mean value; equal to thesum of the squares of the deviation from the mean value.

  • 8/3/2019 1_drss_SAK5308_W01_2011

    36/41

    Example 2.2 Performance perceived by a userdepends in a complex way on the

    system response time

    P

    erformance

    - Viewpoint of a Typist

  • 8/3/2019 1_drss_SAK5308_W01_2011

    37/41

    Example 2.3 Pocket Pager simple functions

    Performance metrics : Not response time

    Battery Power

  • 8/3/2019 1_drss_SAK5308_W01_2011

    38/41

    Example 2.4System C

    special array-processing

    unit 2 matricesmultiplication

    Clock frequency 5 Mhz

    System D

    - no such unit

    - Clock frequency 10Mhz

    +

    x0y0

    x1y0x2y0

    xny0

    0

    x0y1+ x1y1

    0

    + x0y2+ x1y2+ 0+

    P(2n-1) P(2n-2) P0

  • 8/3/2019 1_drss_SAK5308_W01_2011

    39/41

    Example 2.5

    System E

    Simple instruction set

    Machine code twice as

    long as F

    1.5 times faster than F

    System F

    Complex instruction

    set

    Number of instructions

    executed per second

    MIPS

  • 8/3/2019 1_drss_SAK5308_W01_2011

    40/41

    Quite often even if good performance measureQuite often even if good performance measure

    that accurately represents performance as thethat accurately represents performance as the

    user perceives it, theuser perceives it, the application determinesapplication determines howhow

    systems are ranked.systems are ranked.

    PointsPoints

    Frequent possibility for reasonableFrequent possibility for reasonable soundingsounding

    performance measures to be misleading.performance measures to be misleading.

    Performance perceived by the user depends onPerformance perceived by the user depends onso many factors that it is difficult in most casesso many factors that it is difficult in most cases

    to find a measure that is perfect in all respects.to find a measure that is perfect in all respects.

  • 8/3/2019 1_drss_SAK5308_W01_2011

    41/41

    Properties of Performance

    Measures A good performance measure must:

    Represent an efficient encoding of relevant

    information

    Provide an objective basis for the ranking of

    candidate controllers for a given application

    Provide objective optimization criteria