Undergraduate course on Real-time Systems Linköping TDDD07 – Real-time Systems Lecture 1: Introduction & Scheduling I Simin Nadjm-Tehrani Real-time Systems.

Slides:



Advertisements
Similar presentations
Real Time Scheduling.
Advertisements

EE5900 Advanced Embedded System For Smart Infrastructure
CS5270 Lecture 31 Uppaal, and Scheduling, and Resource Access Protocols CS 5270 Lecture 3.
CPE555A: Real-Time Embedded Systems
Courseware Scheduling of Distributed Real-Time Systems Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens.
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems (m, k)-firm tasks and QoS enhancement.
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.
Module 2 Priority Driven Scheduling of Periodic Task
Scheduling Theory ITV Real-Time Systems Anders P. Ravn Aalborg University March 2007.
Scheduling for Embedded Real-Time Systems Amit Mahajan and Haibo.
Chapter 6: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 6: CPU Scheduling Basic.
Scheduling Theory ITV Multiprogramming and Real-Time Programs Anders P. Ravn Aalborg University May 2009.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the RTSJ  Memory Management.
Embedded Systems Exercise 3: Scheduling Real-Time Periodic and Mixed Task Sets 18. May 2005 Alexander Maxiaguine.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
CprE 458/558: Real-Time Systems
Spring 2002Real-Time Systems (Shin) Rate Monotonic Analysis Assumptions – A1. No nonpreemptible parts in a task, and negligible preemption cost –
Real-Time Operating System Chapter – 8 Embedded System: An integrated approach.
More Scheduling cs550 Operating Systems David Monismith.
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Scheduling policies for real- time embedded systems.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Real-Time Scheduling CS 3204 – Operating Systems Lecture 20 3/3/2006 Shahrooz Feizabadi.
Prepare by : Ihab shahtout.  Overview  To give an overview of fixed priority schedule  Scheduling and Fixed Priority Scheduling.
Hard Real-Time Scheduling for Low- Energy Using Stochastic Data and DVS Processors Flavius Gruian Department of Computer Science, Lund University Box 118.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
5 May CmpE 516 Fault Tolerant Scheduling in Multiprocessor Systems Betül Demiröz.
Undergraduate course on Real-time Systems Linköping 1 of 45 Autumn 2009 TDDC47: Real-time and Concurrent Programming Lecture 5: Real-time Scheduling (I)
Real Time Systems Real-Time Schedulability Part I.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
RTOS task scheduling models
SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems RMS and EDF Schedulers.
CSE 522 Real-Time Scheduling (2)
Real-Time Scheduling CS 3204 – Operating Systems Lecture 13 10/3/2006 Shahrooz Feizabadi.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
Introduction to Embedded Systems Rabie A. Ramadan 5.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Dynamic Priority Driven Scheduling of Periodic Task
Introduction to Real-Time Systems
Sandtids systemer 2.modul el. Henriks 1. forsøg m. Power Point.
For a good summary, visit:
11 G53SRP: Feasibility analysis Chris Greenhalgh School of Computer Science.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
1 G53SRP: Introduction to Real Time Scheduling Chris Greenhalgh School of Computer Science.
Clock Driven Scheduling
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Basic Concepts Maximum CPU utilization obtained with multiprogramming
Real-time Embedded Systems Rate monotonic theory scheduling.
Embedded System Scheduling
Wayne Wolf Dept. of EE Princeton University
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
CSCI1600: Embedded and Real Time Software
Chapter 6: CPU Scheduling
Scheduling Basic Concepts Ref: Hard Real-Time Computing Systems Giorgio Buttazzo Ref: Real-Time Systems & Software Alan Shaw Processes - Tasks.
CSCI1600: Embedded and Real Time Software
Uniprocessor scheduling
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Chapter 6: CPU Scheduling
Module 5: CPU Scheduling
Presentation transcript:

Undergraduate course on Real-time Systems Linköping TDDD07 – Real-time Systems Lecture 1: Introduction & Scheduling I Simin Nadjm-Tehrani Real-time Systems Laboratory Department of Computer and Information Science Linköping university 47 pages Autumn 2009

Undergraduate course on Real-time Systems Linköping 2 of 50 Autumn 2009 This lecture Course overview Introduction to Real-time systems CPU as a resource: Scheduling –Cyclic scheduling –Rate monotonic scheduling

Undergraduate course on Real-time Systems Linköping 3 of 50 Autumn 2009 TDDD07: Course contents Resource allocation for real-time processes –CPU scheduling –Multiple resources and deadlock prevention Distributed systems –Scheduling as load distribution –Clocks, synchronisation, timing and its impact on agreement problem

Undergraduate course on Real-time Systems Linköping 4 of 50 Autumn 2009 TDDD07: Course contents Real-time communication –Bus protocols: CAN and TTP –QoS for multimedia Dependability and fault tolerance –Availability and overload management Design of real-time systems Real-time operating systems Industrial lecture

Undergraduate course on Real-time Systems Linköping 5 of 50 Autumn 2009 Evaluation actions TDDD07: –After last year’s evaluation –Added concrete exercises to work with Will appear in week 47 –Added one lesson/resource session

Undergraduate course on Real-time Systems Linköping 6 of 50 Autumn 2009 This lecture Course overview Introduction to Real-time systems CPU as a resource: Scheduling –Cyclic scheduling –Rate monotonic scheduling

Undergraduate course on Real-time Systems Linköping 7 of 50 Autumn 2009 Real-time processes From your operating systems course: scheduler’s role is to ensure that each process gets a share of the CPU With real-time systems it is not enough that processes get a share some time The time that the result of the computation is delivered is as important as the result itself Predictability!

Undergraduate course on Real-time Systems Linköping 8 of 50 Autumn 2009 Predictable is not “fast”! The film...

Undergraduate course on Real-time Systems Linköping 9 of 50 Autumn 2009 Release time External event Computation time Reaction time Deadline What is meant by predictable? Real-time systems: Can all processes meet their deadlines?

Undergraduate course on Real-time Systems Linköping 10 of 50 Autumn 2009 Consider following processes: Computation time (C i )5 ms10 ms Deadline (D i )20 ms12 ms p 1 p 2 p2p2 time p1p1 t0t0 p1p1 p2p2 t0t0 Order matters!

Undergraduate course on Real-time Systems Linköping 11 of 50 Autumn 2009 Deadlines Hard: Not meeting any deadline is a failure of the system Soft: It is desirable that deadlines are met, but OK if they are missed every now and then Firm: It is OK that they are missed now and again, but after the deadline the result is of no use How often?

Undergraduate course on Real-time Systems Linköping 12 of 50 Autumn 2009 Typical application area Vehicle electronics –Power train and chassis –Infotainment/telematics –Body electronics A modern car configuration has over 40 ECUs, distributed over several buses Several applications share each ECU that shares the bus

Undergraduate course on Real-time Systems Linköping 13 of 50 Autumn 2009 Labs in TDDD07 Football playing robots, sharing the brain... Computational processes given, parameters given, how to allocate CPU so that a team plays better football? You will implement three schedulers and compare them in a simulation environment

Undergraduate course on Real-time Systems Linköping 14 of 50 Autumn 2009 Week 50 We will have a demo in the physical Robolab environment! Date: Thursday 10/12, 13-15

Undergraduate course on Real-time Systems Linköping 15 of 50 Autumn 2009 This lecture Course overview Introduction to Real-time systems CPU as a resource: Scheduling –Cyclic scheduling –Rate monotonic scheduling

Undergraduate course on Real-time Systems Linköping 16 of 50 Autumn 2009 Scheduling... is about allocating resources, specially the CPU time, among all computational processes such that the timeliness requirements are met. The scheduler decides which process is to be executed next.

Undergraduate course on Real-time Systems Linköping 17 of 50 Autumn 2009 Scheduling Performed off-line or on-line With information available statically or dynamically Preemptive or non-preemptive

Undergraduate course on Real-time Systems Linköping 18 of 50 Autumn 2009 Schedulability Test Sufficient –if test is passed, then tasks are definitely schedulable –if test is not passed, we don’t know Necessary – if test is passed, we don’t know – if test is not passed, tasks are definitely not schedulable Exact test: –sufficient & necessary at the same time

Undergraduate course on Real-time Systems Linköping 19 of 50 Autumn 2009 Which parameters? Scheduling policy induces an order on executions using an algorithm and a set of parameters for the task set: Worst case execution time (WCET) Deadline Release time...

Undergraduate course on Real-time Systems Linköping 20 of 50 Autumn 2009 Process parameters How to find the maximum computation time for each process? How to determine deadlines? When (how often) is a process released?

Undergraduate course on Real-time Systems Linköping 21 of 50 Autumn 2009 Release times Reading and reacting to continuous signals – Periodicity Recognising/reacting to some aperiodic events – Minimum inter-arrival time  Sporadic processes

Undergraduate course on Real-time Systems Linköping 22 of 50 Autumn 2009 Cyclic scheduling An off-line schedule is created based on statically known and fixed parameters Off-line decision –When executing: Run the processes in pre-determined order using a table look-up To run processes in the “right” frequency find –Minor cycle –Major cycle

Undergraduate course on Real-time Systems Linköping 23 of 50 Autumn 2009 Consider following processes:P 1 P 2 Period(Ti)/Deadline50100 Worst case execution time (Ci) Note: repetition!... time Example (1)

Undergraduate course on Real-time Systems Linköping 24 of 50 Autumn 2009 A cyclic executive every_major_cycle do{ read all in_signals; run_minor_cycle_1_processes; wait_for_interrupt; write all out_signals;... read all in_signals; run_minor_cycle_n_processes; wait_for_interrupt; write all out_signals; } End of minor cycle

Undergraduate course on Real-time Systems Linköping 25 of 50 Autumn 2009 No preemption! What happens if the periods are not harmonic?

Undergraduate course on Real-time Systems Linköping 26 of 50 Autumn 2009 Minor cycle: greatest common devisor (sv. sgd) Major cycle: least common multiplier (sv. mgn) Example (2): processABC period Finding Minor/Major Cycle

Undergraduate course on Real-time Systems Linköping 27 of 50 Autumn 2009 Iterative construction Off-line analysis in order to fix the schedule might be iterative –Each process P i is assumed to be strictly periodic (i.e. should be completed once every T i ) –Check: Will the schedule work with the natural periods and computation times? –Otherwise, change the parameters! Which parameters can we change?

Undergraduate course on Real-time Systems Linköping 28 of 50 Autumn 2009 Recall example 2: processABC period Harmonic processes

Undergraduate course on Real-time Systems Linköping 29 of 50 Autumn 2009 What if periods are not harmonic?

Undergraduate course on Real-time Systems Linköping 30 of 50 Autumn 2009 How to construct? If the periods are not harmonically related – change the periods – all processes should be run at least as often as every (original) T i Place the processes in minor cycle and major cycle until repetition appears

Undergraduate course on Real-time Systems Linköping 31 of 50 Autumn 2009 processAB period75100 Alternative 1: Run process B more often than necessary, e.g. once every 75 time units. time minor cycle Drawbacks? Example (3.1)

Undergraduate course on Real-time Systems Linköping 32 of 50 Autumn 2009 processAB period75100 Alternative 2: Choose minor cycle as greatest common divisor, and move processes backwards in time when they clash.... Drawbacks? time Example (3.2)

Undergraduate course on Real-time Systems Linköping 33 of 50 Autumn 2009 Jitter control Many applications need to minimise jitter in reading data from sensors or producing output to actuators

Undergraduate course on Real-time Systems Linköping 34 of 50 Autumn 2009 processAB period75100 Alternative 3: A mix of the last two minor cycle Drawbacks? Example (3.3) time

Undergraduate course on Real-time Systems Linköping 35 of 50 Autumn 2009 Schedulability test Sum of processes’ execution times (WCET) in each minor cycle is less than the cycle’s length, and processes run at the ”right” frequency If succeeded: the schedule, whose length corresponds to the major cycle, is repeated for all executions

Undergraduate course on Real-time Systems Linköping 36 of 50 Autumn 2009 If they don’t fit? Break some process that does not fit into two or more processes and run the different parts in different minor cycles Drawbacks? Creates new processes out of the old one!

Undergraduate course on Real-time Systems Linköping 37 of 50 Autumn 2009 What if dependent? So far we assumed all processes are independent. Dependence can be due to sharing resources or computation precedence requirements In either case, the fixed order has to respect dependencies

Undergraduate course on Real-time Systems Linköping 38 of 50 Autumn 2009 Summary Cycles can be hard to determine and can become looong... Very inflexible Can lead to high processor utilisation Long WCET can create problems Sporadic processes are run periodically

Undergraduate course on Real-time Systems Linköping 39 of 50 Autumn 2009 Simple at run-time No overheads for context switching Processes can exchange data without the need for explicit (dynamic) synchronisation But...

Undergraduate course on Real-time Systems Linköping 40 of 50 Autumn 2009 Run-time behaviour What is the deadline for each process? How does one know that processes meet their deadlines? What happens if they don’t?

Undergraduate course on Real-time Systems Linköping 41 of 50 Autumn 2009 Better methods needed For: Processes with long WCET Sporadic events Processes with long period but short deadline Process dependence –sharing resources –overruns

Undergraduate course on Real-time Systems Linköping 42 of 50 Autumn 2009 Priority-based scheduling A preemptive method where the priority of the process determines whether it continues to run or it is disrupted ”Most important process first!”

Undergraduate course on Real-time Systems Linköping 43 of 50 Autumn 2009 RMS Rate Monotonic Scheduling: On-line Preemptive Priority-based with fixed (static) priorities

Undergraduate course on Real-time Systems Linköping 44 of 50 Autumn 2009 Priorities Each process has a period T i that is the shortest interval between its release times Processes are assigned priorities dependent on length of T i – The shorter T i the higher the priority

Undergraduate course on Real-time Systems Linköping 45 of 50 Autumn 2009 Example (4) P1 P2 P3 Period (Ti) WCET (Ci) Priority high low medium

Undergraduate course on Real-time Systems Linköping 46 of 50 Autumn 2009 Consider following scenario: arrival timeprocess 0P1, P2, P3 20 P1 30 P3 40P1 50P2 60P1, P preemption time

Undergraduate course on Real-time Systems Linköping 47 of 50 Autumn 2009 Schedulability test Theorem: (sufficient condition) For n processes, RMS will guarantee their schedulability if the total utilisation U = C 1 /T C n /T n does not exceed the guarantee level G = n (2 1/n -1)