Processes and operating systems zMultiple tasks and multiple processes. ySpecifications of process timing. zPreemptive real-time operating systems.

Slides:



Advertisements
Similar presentations
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Processes and operating systems zScheduling policies: yRMS; yEDF. zScheduling modeling.
Advertisements

1 (Review of Prerequisite Material). Processes are an abstraction of the operation of computers. So, to understand operating systems, one must have a.
Real Time Scheduling Terminologies define Fixed Priority Scheduler
WHAT IS AN OPERATING SYSTEM? An interface between users and hardware - an environment "architecture ” Allows convenient usage; hides the tedious stuff.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 15 Slide 1 Real-time Systems 2.
Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by.
© 2008 Wayne Wolf Overheads for Computers as Components 2 nd ed. Processes and operating systems zMultiple tasks and multiple processes. ySpecifications.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
1: Operating Systems Overview
OS Spring’03 Introduction Operating Systems Spring 2003.
REAL-TIME SOFTWARE SYSTEMS DEVELOPMENT Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Chapter 1 and 2 Computer System and Operating System Overview
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Spring 2002Real-Time Systems (Shin) Rate Monotonic Analysis Assumptions – A1. No nonpreemptible parts in a task, and negligible preemption cost –
OS Spring’04 Introduction Operating Systems Spring 2004.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 1: Introduction What is an Operating System? Mainframe Systems Desktop Systems.
REAL-TIME SOFTWARE SYSTEMS DEVELOPMENT Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Real Time Process Control (Introduction)
Real-Time Kernel (Part 1)
LOGO OPERATING SYSTEM Dalia AL-Dabbagh
Operating System Review September 10, 2012Introduction to Computer Security ©2004 Matt Bishop Slide #1-1.
MICROPROCESSOR INPUT/OUTPUT
1. Introduction 1.1 Background 1.2 Real-time applications 1.3 Misconceptions 1.4 Issues in real-time computing 1.5 Structure of a real-time system.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Classification of scheduling policies Preemptive methods (typical representative: RR) Non-preemptive methods (typical representative: FCFS) Preemption.
Scheduling policies for real- time embedded systems.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Operating Systems Process Management.
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
Interrupts general concepts interrupt systems. Interrupts - concepts 2/27 Interrupt - the event inside or outside of microprocessor system, requested.
REAL-TIME SOFTWARE SYSTEMS DEVELOPMENT Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems  Operating systems.
© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems Operating systems. 1.
1: Operating Systems Overview 1 Jerry Breecher Fall, 2004 CLARK UNIVERSITY CS215 OPERATING SYSTEMS OVERVIEW.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
CS4730 Real-Time Systems and Modeling Fall 2010 José M. Garrido Department of Computer Science & Information Systems Kennesaw State University.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
© 2000 Morgan Kaufman Overheads for Computers as Components Processes and operating systems zMotivation for processes. zThe process abstraction. zContext.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Introduction to Real-Time Systems
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Unit - I Real Time Operating System. Content : Operating System Concepts Real-Time Tasks Real-Time Systems Types of Real-Time Tasks Real-Time Operating.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Introduction to operating systems What is an operating system? An operating system is a program that, from a programmer’s perspective, adds a variety of.
Lecture 6: Real-Time Scheduling
REAL-TIME OPERATING SYSTEMS
EC6703 EMBEDDED AND REAL TIME SYSTEMS
Topics Covered What is Real Time Operating System (RTOS)
The deadline establish a priority among interrupt requests.
Wayne Wolf Dept. of EE Princeton University
Real-time Software Design
Chapter 6: CPU Scheduling
CSCI1600: Embedded and Real Time Software
Module 2: Computer-System Structures
RTS: Kernel Design 11/30/2018.
RTS: Kernel Design 1/2/2019.
Module 2: Computer-System Structures
Processes and operating systems
Chapter 10 Multiprocessor and Real-Time Scheduling
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Presentation transcript:

Processes and operating systems zMultiple tasks and multiple processes. ySpecifications of process timing. zPreemptive real-time operating systems.

Reactive systems zRespond to external events. yEngine controller. ySeat belt monitor. zRequires real-time response. ySystem architecture. yProgram implementation. zMay require a chain reaction among multiple processors.

Tasks and processes zA task is a functional description of a connected set of operations. z(Task can also mean a collection of processes.) zA process is a unique execution of a program. ySeveral copies of a program may run simultaneously or at different times. zA process has its own state: yregisters; ymemory. zThe operating system manages processes.

Why multiple processes? zMultiple tasks means multiple processes. zProcesses help with timing complexity: ymultiple rates xmultimedia xautomotive yasynchronous input xuser interfaces xcommunication systems

Multi-rate systems zTasks may be synchronous or asynchronous. zSynchronous tasks may recur at different rates. zProcesses run at different rates based on computational needs of the tasks.

Example: engine control zTasks: yspark control( 点火控 制 ) ycrankshaft sensing yfuel/air mixture yoxygen sensor yKalman filter engine controller

Typical rates in engine controllers VariableFull range time (ms)Update period (ms) Engine spark timing3002 Throttle402 Air flow304 Battery voltage804 Fuel flow25010 Recycled exhaust gas50025 Status switches10020 Air temperatureSeconds400 Barometric pressureSeconds1000 Spark (dwell)101 Fuel adjustment808 Carburetor50025 Mode actuators100

Real-time systems zPerform a computation to conform to external timing constraints. zDeadline frequency: yPeriodic. yAperiodic. zDeadline type: yHard: failure to meet deadline causes system failure. ySoft: failure to meet deadline causes degraded response. yFirm: late response is useless but some late responses can be tolerated.

Timing specifications on processes zRelease time: time at which process becomes ready. zDeadline: time at which process must finish.

Release times and deadlines time P1 initiating event deadline aperiodic process periodic process initiated at start of period period P1 deadline period periodic process initiated by event

Rate requirements on processes zPeriod: interval between process activations. zRate: reciprocal (倒 数) of period. zInitiation rate may be higher than period--- several copies of process run at once. time P1 1 P1 2 P1 3 P1 4 CPU 1 CPU 2 CPU 3 CPU 4

Timing violations zWhat happens if a process doesn’t finish by its deadline? yHard deadline: system fails if missed. ySoft deadline: user may notice, but system doesn’t necessarily fail.

Example: Space Shuttle software error zSpace Shuttle’s first launch was delayed by a software timing error: yPrimary control system PASS and backup system BFS. yBFS failed to synchronize with PASS. yChange to one routine added delay that threw off start time calculation. y1 in 67 chance of timing problem.

Task graphs zTasks may have data dependencies---must execute in certain order. zTask graph shows data/control dependencies between processes. zTask: connected set of processes. zTask set: One or more tasks. P3 P1P2 P4 P5 P6 task 1task 2 task set

Communication between tasks zTask graph assumes that all processes in each task run at the same rate, tasks do not communicate. zIn reality, some amount of inter-task communication is necessary. yIt’s hard to require immediate response for multi-rate communication. MPEG system layer MPEG audio MPEG video

Process execution characteristics zProcess execution time T i. yExecution time in absence of preemption. yPossible time units: seconds, clock cycles. yWorst-case, best-case execution time may be useful in some cases. zSources of variation: yData dependencies. yMemory system. yCPU pipeline.

Utilization (利用率) zCPU utilization: yFraction of the CPU that is doing useful work. yOften calculated assuming no scheduling overhead. zUtilization: yU = (CPU time for useful work )/ (total available CPU time) = [  t1 ≤ t ≤ t2 T(t) ] / [t2 – t1] = T/t

State of a process zA process can be in one of three states: yexecuting on the CPU; yready to run; ywaiting for data. executing readywaiting gets data and CPU needs data gets data needs data preempted gets CPU

The scheduling problem zCan we meet all deadlines? yMust be able to meet deadlines in all cases. zHow much CPU horsepower do we need to meet our deadlines?

Scheduling feasibility zResource constraints make schedulability analysis NP-hard. yMust show that the deadlines are met for all timings of resource requests. P1P2 I/O device

Simple processor feasibility zAssume: yNo resource conflicts. yConstant process execution times. zRequire:  T ≥  i T i yCan’t use more than 100% of the CPU. T1T1 T2T2 T3T3 T

Hyperperiod zHyperperiod: least common multiple (LCM) of the task periods. zMust look at the hyperperiod schedule to find all task interactions. zHyperperiod can be very long if task periods are not chosen carefully.

Hyperperiod example zLong hyperperiod: yP1 7 ms. yP2 11 ms. yP3 15 ms. yLCM = 1155 ms. zShorter hyperperiod: yP1 8 ms. yP2 12 ms. yP3 16 ms. yLCM = 96 ms.

Simple processor feasibility example zP1 period 1 ms, CPU time 0.1 ms. zP2 period 1 ms, CPU time 0.2 ms. zP3 period 5 ms, CPU time 0.3 ms.

Cyclostatic (静态循环) /TDMA ( Time Division Multiple Access 时分多路访问) zSchedule in time slots. ySame process activation irrespective of workload. zTime slots may be equal size or unequal. T1T1 T2T2 T3T3 P T1T1 T2T2 T3T3 P

TDMA assumptions zSchedule based on least common multiple (LCM) of the process periods. zTrivial scheduler - > very small scheduling overhead. P1P1 P1P1 P1P1 P2P2 P2P2 P LCM

TDMA schedulability zAlways same CPU utilization (assuming constant process execution times). zCan’t handle unexpected loads. yMust schedule a time slot for aperiodic events.

TDMA schedulability example zTDMA period = 10 ms. zP1 CPU time 1 ms. zP2 CPU time 3 ms. zP3 CPU time 2 ms. zP4 CPU time 2 ms.

Round-robin (轮询) zSchedule process only if ready. yAlways test processes in the same order. zVariations: yConstant system period. yStart round-robin again after finishing a round. T1T1 T2T2 T3T3 P T2T2 T3T3 P

Round-robin assumptions zSchedule based on least common multiple (LCM) of the process periods. zBest done with equal time slots for processes. zSimple scheduler -> low scheduling overhead. yCan be implemented in hardware.

Round-robin schedulability zCan bound maximum CPU load. yMay leave unused CPU cycles. zCan be adapted to handle unexpected load. yUse time slots at end of period.

Schedulability and overhead zThe scheduling process consumes CPU time. yNot all CPU time is available for processes. zScheduling overhead must be taken into account for exact schedule. yMay be ignored if it is a small fraction of total execution time.

Running periodic processes zNeed code to control execution of processes. zSimplest implementation: process = subroutine.

while loop implementation zSimplest implementation has one loop. yNo control over execution timing. while (TRUE) { p1(); p2(); }

Timed loop implementation zEncapuslate set of all processes in a single function that implements the task set,. zUse timer to control execution of the task. yNo control over timing of individual processes. void pall(){ p1(); p2(); }

Multiple timers implementation zEach task has its own function. zEach task has its own timer. yMay not have enough timers to implement all the rates. void pA(){ /* rate A */ p1(); p3(); } void B(){ /* rate B */ p2(); p4(); p5(); }

Timer + counter implementation zUse a software count to divide the timer. zOnly works for clean multiples of the timer period. int p2count = 0; void pall(){ p1(); if (p2count >= 2) { p2(); p2count = 0; } else p2count++; p3(); }

Implementing processes zAll of these implementations are inadequate. zNeed better control over timing. zNeed a better mechanism than subroutines.