220 likes | 449 Views
Introduction to Real-Time Systems. Fred Kuhns Computer Science Dept. Washington University. What is a Real-Time System?.
E N D
Introduction to Real-Time Systems Fred Kuhns Computer Science Dept. Washington University
What is a Real-Time System? • Real-time systems have been defined as: "those systems in which the correctness of the system depends not only on the logical result of the computation, but also on the time at which the results are produced"; • J. Stankovic, "Misconceptions About Real-Time Computing," IEEE Computer, 21(10), October 1988. CS523 – Operating Systems
Real-Time Characteristics • Real-time systems often are comprised of a controlling system, controlled system and environment. • Controlling system: acquires information about environment using sensors and controls the environment with actuators. • Timing constraintsderived from physical impact of controlling systems activities. Hard and soft constraints. • Periodic Tasks: Time-driven recurring at regular intervals. • Aperiodic: Event-driven. CS523 – Operating Systems
sensor actuator sensor actuator sensor actuator sensor actuator Typical Real-Time System Controlled System Controlling System Environment CS523 – Operating Systems
Some Definitions • Timing constraint: constraint imposed on timing behavior of a job: hard or soft. • Release Time: Instant of time job becomes available for execution. If all jobs are released when the system begins execution, then there is said to be no release time • Deadline: Instant of time a job's execution is required to be completed. If deadline is infinity, then job has no deadline. Absolute deadline is equal to release time plus relative deadline • Response time: Length of time from release time to instant job completes. CS523 – Operating Systems
Hard versus Soft • Hard: failure to meet constraint is a fatal fault. Validated system always meets timing constraints. • Deterministic constraints • Probabilistic constraints • Constraints in terms of some usefulness function. • Soft: late completion is undesirable but generally not fatal. No validation or only demonstration job meets some statistical constraint. Occasional missed deadlines or aborted execution is usually considered tolerable. Often specified in probabilistic terms CS523 – Operating Systems
Validating Constraints • Validation: Demonstration by a provably correct, efficient procedure or by exhaustive simulation and testing. Involves three steps: • timing constraints of each application and corresponding components are consistent, • each component can meet its timing constraints if executed alone and required resources are available, • the underlying scheduling algorithm(s) result in all timing constraints being met CS523 – Operating Systems
Developing a Reference Model • Modeling the system to focus on timing properties and resource requirements. Composed of three elements: • workload model - describes supported applications • Temporal parameters • Precedence constraints and dependencies • Functional parameters • resource model - describes available system resources • Modeling resources (Processors and Resources) • Resource parameters • algorithms - how application uses resources at all times • Scheduling Hierarchy CS523 – Operating Systems
Tasks and Jobs: Definitions • Task (Ti): Set of related jobs jointly provide function. • Job (Jij): Unit of work, scheduled and executed by system. characterized by the following parameters: • Temporal parameters: timing constraints and behavior • Functional parameters: intrinsic properties of the job. • Resource parameters: resource requirements. • Interconnection parameters: how it depends on other jobs and how other jobs depend on it CS523 – Operating Systems
Resources • Resources can be divided into passive and active: • Active resources == Processors (Pi): they execute jobs. • Every job must have one or more processors • Same type if functionally identical and used interchangeably. • Passive resource == Resource (Ri): • job may require Resources in addition to processor. • reusable resources are not consumed CS523 – Operating Systems
Job/Task Temporal Parameters • Hard real-time: number and parameters of tasks are known at all time. • for Job Ji: • ri - release time, may know range [r-, r+] (jitter). For aperiodic/sporadic release or interrelease time is a random variable. • di - absolute deadline • Di - relative deadline • (ri, di] - feasible interval • ei - Execution time. May know range [e-, e+]. Most deterministic models use e+. CS523 – Operating Systems
Periodic Task Model • Jobs repeated at regular or semi-regular intervals modeled as periodic. • Task Ti is a serious of periodic Jobs Jij. • pi - period, minimum interrelease interval between jobs in Task Ti. Must be bounded from below. • ei - maximum execution time for jobs in task Ti. • rij - release time of the jth Job in Task i (Jij in Ti). • i - phase of Task Ti, equal to ri1. • H - Hyperperiod = Least Common Multiple of pi for all i: H = lcm(pi), for all i. • ui - utilization of Task Ti. • U - Total utilization = Sum over all ui. CS523 – Operating Systems
Aperiodic and Sporadic Tasks • A periodic or Sporadic task is a stream of aperiodic or sporadic jobs. • Jobs with a task have similar statistical behavior and timing requirements • Assumed system is stationary within the hyperperiod • Aperiodic: jobs have soft or no deadlines. Want responsiveness. • Sporadic: jobs have hard deadlines CS523 – Operating Systems
Precedence Constraints and Task Graphs • Jobs are either precedence constrained or independent. • Precedence relation: partial ordering operator < • Ji < Jk : Ji is predecessor of Jk, Jk is successor of Ji • directed graph G = (J,<) • Task graph is an extended precedence graph. CS523 – Operating Systems
Functional Parameters • Preemptivity • Preemption: suspend job then dispatch different job to processor. Cost includes context switch overhead. • Non-preemptable task - must be run from start to completion. • Criticalness - positive integer indicating the relative importance of a job. Useful during overload. • Optional Executions - jobs or portions of jobs may be declared optional. Useful during overload. • Laxity - Laxity type => hard or soft timing constraints. Supplemented by a usefulness function. Useful during overload. CS523 – Operating Systems
Resource Parameters • Job resource parameters indicate processor and resource requirements. • Preemptivity of resources • non-preemptive: serial access, typical case. • preemptive - jobs can interleave access. • Resource Graph: • vertex for processors (Pi) and resources (Ri) • is-a-part-of edge: Ri -> Rk, Rk is a part of Ri • accessibility edge: Pi -> Pk, cost of Pi accessing Pk CS523 – Operating Systems
Schedules and Scheduling • Jobs scheduled and allocated resources based on a set of scheduling algorithms and access control protocols. • Scheduler: Module implementing scheduling algorithms • Schedule: assignment of all jobs to available processors, produced by scheduler. • Valid schedule: • every processor assigned to at most one job at a time • every job assigned to at most one processor at a time • no job scheduled before its release time • Total amount of processor time assigned to every job is equal to its maximum or actual execution time CS523 – Operating Systems
Definitions • Feasible schedule: Every job starts at or after release time and completes by deadline • Schedulable: set of jobs schedulable according to an algorithm if the it always produces a feasible schedule. • Optimal: Scheduling algorithm optimal if it always produces a feasible schedule if such a schedule exists • Tardiness: Zero if completion time <= deadline, otherwise > 0 (complete - deadline). • Lateness: difference between completion time and deadline, can be negative if early. CS523 – Operating Systems
Performance Measures • Miss rate: percentage of jobs executed but completed late • Loss rate: percentage of jobs discarded • Invalid rate: sum of miss and loss rate. • makespan : If all jobs have same release time and deadline, then makespan = response time of the last job to execute. • Max or average response times • Max or average tardiness/lateness CS523 – Operating Systems