L23_Reference Model for RT Systems

download L23_Reference Model for RT Systems

of 31

Transcript of L23_Reference Model for RT Systems

  • 7/31/2019 L23_Reference Model for RT Systems

    1/31

    CS C 424 Software for Embedded systems

    Software for embedded systems

    Cs 424First Semester

    2012-13

    Reference model for real time systems

  • 7/31/2019 L23_Reference Model for RT Systems

    2/31

    CS C 424 Software for Embedded systems 2

    Definition

    Coarse definition

    A system which is required to complete itswork and deliver its services on a timelybasis

    Ex:Digital control

    Signaling

    Radar systems

    Guided missiles

    Multi media applications

    Alarm management

  • 7/31/2019 L23_Reference Model for RT Systems

    3/31

    CS C 424 Software for Embedded systems

    Hard real time systems

    Timing constraints:

    Hard dead lines

    Soft dead lines

    Tardiness

    Measured in deterministic or probabilistic terms

    Hard real time job: User requires validation that the system always meet

    the timing constraint.

    Job must never miss its deadline

    Usefulness of the results falls off abruptly

    Need:

    Required responsiveness

    Safety

  • 7/31/2019 L23_Reference Model for RT Systems

    4/31

    CS C 424 Software for Embedded systems

    Soft real time systems

    Jobs have soft dead lines

    Occasionally missed dead lines-tolerable

    Aborted executions are tolerable

    Quality specified in probabilistic terms

    Ex:

    Telephone exchange

    Multimedia

  • 7/31/2019 L23_Reference Model for RT Systems

    5/31

    CS C 424 Software for Embedded systems

    Examples

    Hard real-time:Flight control

    Railway signaling

    Anti-lock brakes

    Etc.

    Soft real-time:Stock trading systemDVD player

    Mobile phone

    Etc

  • 7/31/2019 L23_Reference Model for RT Systems

    6/31

    CS C 424 Software for Embedded systems

    Basic classification

    Purely cyclic

    Mostly cyclic

    Asynchronous and some what predictable

    Asynchronous and unpredictable

  • 7/31/2019 L23_Reference Model for RT Systems

    7/31

    CS C 424 Software for Embedded systems

    A Reference Model of Real-Time Systems

    A model to reason about real-time systems

    Consistent terminology

    Characteristics A workload model that describes the applications supported by

    the system

    A resource model that describes the system resourcesavailable to the applications

    Algorithms that define how the application system uses theresources at all times

  • 7/31/2019 L23_Reference Model for RT Systems

    8/31

    CS C 424 Software for Embedded systems 8

    Motivation

    A model to analyze real-time systems

    Focus on the important aspects of a system

    Characteristics

    Workload model

    Resource model

    Algorithms

  • 7/31/2019 L23_Reference Model for RT Systems

    9/31

    CS C 424 Software for Embedded systems

    Jobs and tasks

    Ajob is a unit of work that is scheduled and

    executed by a systemcomputation of a control-law

    computation of an FFT on sensor data,

    transmission of a data packet,

    retrieval of a file A task is a set of related jobs which jointly

    provide some function

    keeping an airplane flying at a constant altitude

  • 7/31/2019 L23_Reference Model for RT Systems

    10/31

    CS C 424 Software for Embedded systems

    Processors and Resources

    A job executes or is executed by theoperating system on a processor andmay depend on some resources

    Processor(P):

    active component on which jobs scheduledhave speed as attribute

    Resource ( R ):

    a passive entity upon which jobs may depend

  • 7/31/2019 L23_Reference Model for RT Systems

    11/31

    CS C 424 Software for Embedded systems

    Use of Resources

    If the system contains types of resources,

    there are different types ofserially reusableresources

    One job can use each unit at once (mutually

    exclusive access) A job must obtain a unit of a needed resource,

    use it, then release it

    A resource is plentifulif no job is ever preventedfrom executingby the unavailability of units ofthe resource

  • 7/31/2019 L23_Reference Model for RT Systems

    12/31

    CS C 424 Software for Embedded systems

    Execution Time

    A job Ji will execute for time eiAmount of time required to complete the

    execution of Ji when it executes alone and hasall the resources it needs

    Execution times fall into an interval [ei-, ei

    +];

    Validate a system using ei+for each job

  • 7/31/2019 L23_Reference Model for RT Systems

    13/31

    CS C 424 Software for Embedded systems

    Release and Response Time

    Release time

    The instant in time when a job becomesavailable for execution

    Response time

    The length of time from the release timeof the job to the time instant when itcompletes

  • 7/31/2019 L23_Reference Model for RT Systems

    14/31

    CS C 424 Software for Embedded systems

    Deadlines and Timing Constraints Completion time the instant at which a job completes

    execution Relative deadline the maximum allowable job response time

    Absolute deadline the instant of time by which a job isrequired to be completed (often called simply the deadline) absolute deadline = release time + relative deadline

    Feasible interval for a job Ji is the interval (ri, di]

  • 7/31/2019 L23_Reference Model for RT Systems

    15/31

    CS C 424 Software for Embedded systems

    Example A system to monitor and control a heating furnace

    The system takes 20ms to initialize For every 100 ms,

    Samples , reads temparature

    Computes the control-law,

    Adjusts flow rates

    The release time ofJk is 20 + (k 100) ms

  • 7/31/2019 L23_Reference Model for RT Systems

    16/31

    CS C 424 Software for Embedded systems

    Example..

  • 7/31/2019 L23_Reference Model for RT Systems

    17/31

    CS C 424 Software for Embedded systems

    Types of Tasks

    Types:

    Periodic

    Aperiodic

    Sporadic

    Must be modeled differently Differing scheduling algorithms

    Differing impact on system performance

    Differing constraints on scheduling

  • 7/31/2019 L23_Reference Model for RT Systems

    18/31

    CS C 424 Software for Embedded systems

    Modeling Periodic Tasks

    A set of jobs that are executed repeatedly at

    regular time intervals

    Ti is a sequence of jobs Ji,1, Ji,2, , Ji,n

    Phase of a task Ti =release time ri,1 of the first

    job Ji,1

    Period pi of a task Ti is the minimum length of all

    time intervals between release times of

    consecutive jobs

    Execution time ei of a task Ti is the maximum

    execution time of all jobs in the periodic task

  • 7/31/2019 L23_Reference Model for RT Systems

    19/31

    CS C 424 Software for Embedded systems

    Modelling Periodic Tasks

    Hyper-period of a set of periodic

    tasks h= lcm(pi) for i= 1, 2, , n T1 : p1 = 3, e1 = 1

    T2 : p2 = 5, e2 = 2

  • 7/31/2019 L23_Reference Model for RT Systems

    20/31

    CS C 424 Software for Embedded systems

    Modeling Periodic Tasks..

    Ui (utilization of taskTi)=ei/pi

    Total utilization=U = ui

    Usually assume the relative deadline for the

    jobs in a task is equal to the period of the task

  • 7/31/2019 L23_Reference Model for RT Systems

    21/31

    CS C 424 Software for Embedded systems

    Hard timing constraints

    Deterministic constraints

    Probabilistic constraints

    Constraints in terms of some usefulnessfunctions.

    Mostly specified as deterministic asvalidation is easy.

  • 7/31/2019 L23_Reference Model for RT Systems

    22/31

    CS C 424 Software for Embedded systems

    Response to external events

    Sporadic and aperiodic jobs

    Inter arrival times between jobs varies widely.

    Modeled as a random variable with some

    probability distribution, A(x) .

    Execution times are aperiodic

    Aperiodic:

    Have a soft deadline or no deadline.

    The jobs have similar statistical behaviorSimilar timing requirements

    Sporadic : Has hard deadlines

  • 7/31/2019 L23_Reference Model for RT Systems

    23/31

    CS C 424 Software for Embedded systems

    Precedence Constraints and Dependencies

    Jobs are constrained to execute in a particular

    order

    Ji is predecessor of Jk if Jk cannot begin

    execution until the execution of Ji completes

    Denoted by Ji < Jk

    Immediate predecessorthere is no other job Jjsuch that Ji< Jj< Jk

    A job with a precedence constraint becomesready for execution once when its release time

    has passed and when all predecessors have

    completed

  • 7/31/2019 L23_Reference Model for RT Systems

    24/31

    CS C 424 Software for Embedded systems

    Task graph

  • 7/31/2019 L23_Reference Model for RT Systems

    25/31

    CS C 424 Software for Embedded systems

    Types of dependencies

    Data dependency

    Temporal dependency

    AND/OR precedence

    Conditional branches

    Pipeline relationship

  • 7/31/2019 L23_Reference Model for RT Systems

    26/31

    CS C 424 Software for Embedded systems

    Functional Parameters

    Preemptivity

    A job is preemptable if its execution can be interrupted

    A job is non-preemptable if it must run to completion

    Preemptable jobs can have periods where they cannot be

    preempted

    Criticality Importance of job wrt to other jobs.

    Measured by Priority/weight

    During overload, scheduler optimizes by weighted priority.

    Optional executions Scheduler can leave them executed or partially executed.

    Laxity function Usefulness function gives the value of a job wrt to its tardiness.

    Better never than late

  • 7/31/2019 L23_Reference Model for RT Systems

    27/31

    CS C 424 Software for Embedded systems

    Resource graph

    There is a vertex for each resource(processor or resource)

    Attribute of a vertex is resource type

    Edges represent relationship amongresources

    Is a part ofConnectivity edges

  • 7/31/2019 L23_Reference Model for RT Systems

    28/31

    CS C 424 Software for Embedded systems

    Scheduling

    Jobs scheduled and allocated resources by a

    scheduling algorithm Schedulerassigns jobs to processors

    valid schedulesatisfies

    Every processor is assigned to at most one job at any time

    Every job is assigned at most one processor at any time

    No job is scheduled before its release time

    Amount of processor time assigned to every job is equal to its

    maximum or actual execution time

    All the precedence and resource usage constraints are satisfied

  • 7/31/2019 L23_Reference Model for RT Systems

    29/31

    CS C 424 Software for Embedded systems

    Scheduling..

    A valid schedule is also a feasible schedule if

    every job meets its timing constraints.Miss rate is the percentage of jobs that are executed but

    completed too late

    Loss rate is the percentage of jobs that are not executed at all

    A hard real time scheduling algorithm is optimalif the algorithm always produces a feasible

    schedule if the given set of jobs has feasible

    schedules

    Many scheduling algorithms exist: main focus of

    this module is understanding real-time

    scheduling

  • 7/31/2019 L23_Reference Model for RT Systems

    30/31

    CS C 424 Software for Embedded systems

    Summary

    Outline of terminology and a reference

    model:Jobs and tasks

    Processors and resources

    Time and timing constraints Hard real-time

    Soft real-time

    Periodic, aperiodic and sporadic tasks

    Precedence constraints and dependencies Scheduling

  • 7/31/2019 L23_Reference Model for RT Systems

    31/31

    CS C 424 Software for Embedded systems

    Summary

    Concerned with release times and deadlines of jobs

    Scheduler will ensure: Job is scheduled after its release time.

    Job completes by its deadline.

    Tasks can be hard or soft

    Hard real time system may have several soft jobs and vice

    versa

    Validation:

    1. Ensure the timing constraints are consistent withrequirements

    2. Timing constraint of each component meets its timing if it is

    executed alone and has all resources.

    3. When scheduled together, the timing constraints are metwhen all applications contend for resources.