Reference Model and Scheduling Policies for Real-Time Systems

Similar documents
RTker. Anubha Verma Shikha Kapoor

Event-Driven Scheduling. (closely following Jane Liu s Book)

Concurrent activities in daily life. Real world exposed programs. Scheduling of programs. Tasks in engine system. Engine system

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

Implementing Scheduling Algorithms. Real-Time and Embedded Systems (M) Lecture 9

Priority-driven Scheduling of Periodic Tasks (2) Advanced Operating Systems (M) Lecture 5

Embedded Systems: OS. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CS4514 Real Time Scheduling

Embedded Systems: OS

8: Scheduling. Scheduling. Mark Handley

Embedded Systems. 5. Operating Systems. Lothar Thiele. Computer Engineering and Networks Laboratory

Exam Review TexPoint fonts used in EMF.

SIDDHARTH GROUP OF INSTITUTIONS :: PUTTUR Siddharth Nagar, Narayanavanam Road QUESTION BANK (DESCRIPTIVE) UNIT I OPERATING SYSTEMS

Tasks. Task Implementation and management

Commercial Real-time Operating Systems An Introduction. Swaminathan Sivasubramanian Dependable Computing & Networking Laboratory

OPERATING SYSTEM CONCEPTS UNDERSTAND!!! IMPLEMENT!!! ANALYZE!!!

Systemy RT i embedded Wykład 11 Systemy RTOS

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

PROCESS SCHEDULING Operating Systems Design Euiseong Seo

EECS 571 Principles of Real-Time Embedded Systems. Lecture Note #10: More on Scheduling and Introduction of Real-Time OS

Multiprocessor and Real-Time Scheduling. Chapter 10

Multimedia Systems 2011/2012

Introduction to Embedded Systems

Scheduling Algorithm and Analysis

Real-time operating systems and scheduling

Micrium µc/os II RTOS Introduction EE J. E. Lumpp

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

2. Introduction to Software for Embedded Systems

Simplified design flow for embedded systems

CPU Scheduling: Objectives

Real-Time Systems Hermann Härtig Real-Time Operating Systems Brief Overview

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable

Real-Time Systems. Real-Time Operating Systems

Department of Computer Science Institute for System Architecture, Operating Systems Group REAL-TIME MICHAEL ROITZSCH OVERVIEW

Uniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling

CS370 Operating Systems

Course Syllabus. Operating Systems

Operating system concepts. Task scheduling

A Predictable RTOS. Mantis Cheng Department of Computer Science University of Victoria

Microkernel/OS and Real-Time Scheduling

CEC 450 Real-Time Systems

Multimedia-Systems. Operating Systems. Prof. Dr.-Ing. Ralf Steinmetz Prof. Dr. rer. nat. Max Mühlhäuser Prof. Dr.-Ing. Wolfgang Effelsberg

Lecture 3. Introduction to Real-Time kernels. Real-Time Systems

UNIT:2. Process Management

CS2506 Quick Revision

Introduction to Real-Time Operating Systems

CEC 450 Real-Time Systems

4/6/2011. Informally, scheduling is. Informally, scheduling is. More precisely, Periodic and Aperiodic. Periodic Task. Periodic Task (Contd.

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Introduction to Real-time Systems. Advanced Operating Systems (M) Lecture 2

Main Points of the Computer Organization and System Software Module

Announcements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM.

Real Time Operating Systems and Middleware

The Real Time Thing. What the hack is real time and what to do with it. 22C3 30. December Erwin Erkinger e.at

Lecture notes Lectures 1 through 5 (up through lecture 5 slide 63) Book Chapters 1-4

Real-Time Component Software. slide credits: H. Kopetz, P. Puschner

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institution of Technology, IIT Delhi

REAL-TIME OPERATING SYSTEMS SHORT OVERVIEW

MARUTHI SCHOOL OF BANKING (MSB)

Enriching Enea OSE for Better Predictability Support

7. Multimedia Operating System. Contents. 7.3 Resource Management. 7.4 Process Management. 7.2 Real Time Systems. 7.5 Prototype Systems. 7.

CHAPTER 2: PROCESS MANAGEMENT

Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed)


Embedded Systems. 6. Real-Time Operating Systems

AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel. Alexander Züpke, Marc Bommert, Daniel Lohmann

Real-Time Operating Systems (Working Draft) What is an Operating System (OS)?

(b) External fragmentation can happen in a virtual memory paging system.

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

CS370 Operating Systems

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Chapter 19: Real-Time Systems. Operating System Concepts 8 th Edition,

1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.

Real-Time Programming

Precedence Graphs Revisited (Again)

CISC 7310X. C05: CPU Scheduling. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/1/2018 CUNY Brooklyn College

RT extensions/applications of general-purpose OSs

Zilog Real-Time Kernel

Scheduling of processes

Process- Concept &Process Scheduling OPERATING SYSTEMS

Chendu College of Engineering & Technology

Reservation-Based Scheduling for IRQ Threads

Comparison of scheduling in RTLinux and QNX. Andreas Lindqvist, Tommy Persson,

Time Handling in Programming Language

CS 153 Design of Operating Systems Winter 2016

Lesson 5: Software for embedding in System- Part 2

TDDD07 Real-time Systems Lecture 10: Wrapping up & Real-time operating systems

Overview. Sporadic tasks. Recall. Aperiodic tasks. Real-time Systems D0003E 2/26/2009. Loosening D = T. Aperiodic tasks. Response-time analysis

LAST LECTURE ROUND-ROBIN 1 PRIORITIES. Performance of round-robin scheduling: Scheduling Algorithms: Slide 3. Slide 1. quantum=1:

A New Real-time Kernel development on an embedded platform

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

6.1 Motivation. Fixed Priorities. 6.2 Context Switch. Real-time is about predictability, i.e. guarantees. Real-Time Systems

MaRTE-OS: Minimal Real-Time Operating System for Embedded Applications

Chapter 5: CPU Scheduling

Titolo presentazione. Scheduling. sottotitolo A.Y Milano, XX mese 20XX ACSO Tutoring MSc Eng. Michele Zanella

QUESTION BANK UNIT I

EMERALDS: a small-memory real-time microkernel

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

CPU Scheduling. The scheduling problem: When do we make decision? - Have K jobs ready to run - Have N 1 CPUs - Which jobs to assign to which CPU(s)

Transcription:

ESG Seminar p.1/42 Reference Model and Scheduling Policies for Real-Time Systems Mayank Agarwal and Ankit Mathur Dept. of Computer Science and Engineering, Indian Institute of Technology Delhi

ESG Seminar p.2/42 Outline of the Presentation Introduction to Real-Time Systems A Reference Model of Real-Time Systems Priority-driven Scheduling of Real-Time Systems An overview of Real-Time Kernel (RtKer) Conclusions

ESG Seminar p.3/42 Introduction to Real-Time Systems Correctness based not only on result but also the time-frame within which delivered Hard-Real Time Systems Collision Detection Soft-Real Time Systems Multimedia

ESG Seminar p.4/42 Hard vs Soft Real-Time Systems Hard Real-Time Systems: Require validation that timing constraints are met Guaranteed service No advantage in completing job before deadline Soft Real-Time Systems: Emphasis on small response time and high throughput Best Effort service Should meet some statistical constraints of performance Main emphasis on soft-real systems involving Media applications Emphasis also on vision applications with hard deadlines - tracking, collision detection, etc.

ESG Seminar p.5/42 Outline of the Presentation Introduction to Real-Time Systems A Reference Model of Real-Time Systems Priority-driven Scheduling of Real-Time Systems An overview of Real-Time Kernel (RtKer) Conclusions

ESG Seminar p.6/42 Modeling of Real-Time Systems Components of a model: 1. Workload Model - Applications supported by system. It has following the following parameters: Temporal Parameters Functional Parameters Resource Parameters Interconnection Parameters 2. Resource Model - System resources available to applications 3. Scheduling Model - How application system uses resources

ESG Seminar p.7/42 Workload Model - Temporal Parameters Job - A unit of work done by the system Task - A set of related jobs which jointly provide a system function Phase Temporal Parameters of Task T1 J11 and J12 are Jobs of task T1 Period(p) J11 Exec. Time(e) J12 Sample Code for T1 { loop (N) { //compute... //communicate... Relative Deadline(D) Absolute Deadline(d) } }

Workload Model - Temporal Parameters These parameters give the timing constraints and behavior of a job Periodic Task Model A Periodic Task T i is a sequence of jobs with identical parameters e i A periodic task T i φ i pi Di is described by: Phase φ i : Release time of first job in T i Period p i : Minimum Inter-release interval Execution time e i : Max execution time of a job in T i Relative Deadline D i Under Srijan, tasks are purely periodic with well-defined parameters Role of jitter in periodic task model Aperiodic and Sporadic Tasks ESG Seminar p.8/42

ESG Seminar p.9/42 Workload Model - Interconnection Parameters Defines how the job depends on others, how others depend on it Relationship can be defined based on job constraints and dependency Precedence Graph/ Task Graph defined on J Some types of edge-interconnection parameters: Data dependency Temporal Dependency Temporal dependency is an important parameter in applications like LipSync.

Workload Model - Functional Parameters Used to represent the intrinsic properties of a job. Some functional parameters: Pre-emptivity Criticality Optionality of execution Laxity type and laxity function In media applications, in case of overloading, we can skip frames (Optionality) RtKer doesn t explicitly support optionality property ESG Seminar p.10/42

Resource Model Modeling of resources as Active resources (Servers/Processors) Passive resources (Resources) Processors: CPU, Transmission Link, Disks, etc. Processors carry out machine instruction, move data, retrieve files, etc. Resources: Memory, mutexes, locks, etc. Some Characteristics: Context Switch Time Pre-emptivity Parameters of Resource Vs Resource Parameters of Job ESG Seminar p.11/42

Application Model in Srijan Kahn Process Network (KPN): Interleaved computation and communication In original model, non-blocking writes and blocking reads However, due to limited buffer size, partially-blocking write MPEG Decoding Application (Original SPN Model) T1 T2 T3 q1 q2 Header Extraction Slice Decoding IDCT T1 { compute send(t2) } T2 { recv(t1) loop(n) { compute send(t3) } } T3 { loop(n) { recv(t2) compute } } ESG Seminar p.12/42

Application Model in Srijan (contd.) Loop unrolling for analysis: Convert to tasks with no interleaving However, exact parameters of each job not predictable Static scheduling is possible but only assuming worst case behavior MPEG Decoding Application (After Unrolling to Remove Interleaving) T1 T21 Header Extraction Slice Decoding T22 T31 Period of the System T23 T32 IDCT T24 T33 ESG Seminar p.13/42

Application Model in Srijan (contd.) Using modeling, a compact representation is possible Modeling of the task graph using reference model, involves the following parameters: The process network consisting of the Tasks. T T 1 Ti The number of FIFO s and their sizes The deadlines, periods, execution times, etc. for each of the tasks The data dependency between the tasks, in particular the partial blocking nature of the FIFO writes Such a modeling may also be helpful in analysis and estimation ESG Seminar p.14/42

Application Model in Srijan (contd.) Other possibilities of such a representation: These can be used for systematically validating timing constraints Modeling will be required for specifying the tasks and scheduling policy to the Scheduler Compiler ESG Seminar p.15/42

Outline of the Presentation Introduction to Real-Time Systems A Reference Model of Real-Time Systems Priority-driven Scheduling of Real-Time Systems An overview of Real-Time Kernel (RtKer) Conclusions ESG Seminar p.16/42

Common Scheduling Approaches for Real-Time Systems Clock-Driven approach All parameters of hard real-time jobs fixed and known Schedule computed off-line and used at run-time Scheduling made at specific time instants At each decision time, scheduler schedules according to pre-computed schedule Weighted Round-robin approach Each job given some time slices in a round Number of slices proportional to its weight Used mainly for scheduling real-time traffic in high-speed switched networks However, our main interest is in Priority-driven approach ESG Seminar p.17/42

Priority Scheduling Also known as Greedy/List/Work-conserving Scheduling Never leave any resource idle intentionally On-line scheduling Queues ordered by priorities of jobs Scheduling decisions taken at event occurrences Job with highest priority from relevant queue executed ESG Seminar p.18/42

Dynamic vs Static Partitioning Schemes Dynamic System Common priority queue for processors Jobs are migratable Static Systems Jobs are statically bound to processors Jobs on each processor are scheduled by themselves Dependent jobs on different processors must follow synchronization and resource-access control schemes In worst case, dynamic systems may have poorer response but average performance will be better No reliable validation techniques for dynamic systems In Srijan, tasks are statically partitioned and are bound to fixed processors ESG Seminar p.19/42

Priority Allocation Schemes Based on priority assignment, three categories of algorithms: 1. Fixed priority 2. Task-level dynamic priority 3. Job-level dynamic priority Fixed-priority algorithms are more predictable, dynamic more optimal Most real-time systems are Task-level dynamic (and job-level fixed) RtKer provides two schedulers: EDF and FIFO; both are Task-level dynamic ESG Seminar p.20/42

Fixed Priority Algorithms: RM and DM Rate Monotonic (RM) algorithm: Shorter the period, higher the priority Example of RM Scheduling T1 ( 4,1 ) T2 ( 5,2 ) T3 ( 20,5 ) T1 T2 T3 T1 T2 T3 T1 T3 T2 T1 T3 T2 T1 T2 T1 0 4 8 12 16 20 ESG Seminar p.21/42

Fixed Priority Algorithms: RM and DM Rate Monotonic (RM) algorithm: Shorter the period, higher the priority Example of RM Scheduling T1 ( 4,1 ) T2 ( 5,2 ) T3 ( 20,5 ) T1 T2 T3 T1 T2 T3 T1 T3 T2 T1 T3 T2 T1 T2 T1 0 4 8 12 16 20 Deadline Monotonic (DM) algorithm: Shorter the deadline, higher the priority Example of DM Scheduling T1(50,50,25,100) T2(0,62.5,10,20) T3(0,125,25,50) T2 T3 T1 T2 T1 T1 T2 T3 T1 T2 T1 T2 0 50 62.5 100 125 150 187.5 200 250 ESG Seminar p.21/42

Dynamic Priority algorithms: EDF and LST Example of EDF Scheduling T1 T2 T1 T2 T1 T1 T2 T1 T2 0 2 4 6 8 10 T1(2.1) T2(5.5,3) EDF and LST are optimal: For single processor, with pre-emptable jobs, and no resource contention EDF and LST are not optimal: For multi-processors When preemption is not allowed In overloaded systems Thus, we might need good overload and overrun management strategies ESG Seminar p.22/42

Validation of Timing Constraints in Real-Time Systems The Validation Problem: Given the information: 1. the period p i, execution time e i, and relative deadline D i of every task T i in the system T of independent periodic tasks 2. a priority-driven algorithm used to schedule the tasks in T preemptively on one processor determine whether all the deadlines of every task T i, for every 1 i n are always met Validation algorithms based on specific workload models Fast algorithms well suited for on-line acceptance tests T 1 Tn Efficiency and robustness other desired features in validation algorithms ESG Seminar p.23/42

Validation Example: Workload Model Every job is preemptable at any time Once a job is released, it never suspends itself and is ready for execution till completion Scheduling and context-switch time is negligible Scheduler is event driven and acts immediately upon event occurrences Every task (or job) has a distinct priority Every job in a fixed priority system is scheduled at a constant priority ESG Seminar p.24/42

Validation Example: Validation for EDF Some parameters: 1. Schedulable utilization u k of task T k is given by e k p k. 2. Schedulable utilization U of the system is the sum of individual utilizations, u k. 3. Density of task T k is e k min D k 4. Density of the system, is the sum of densities of all tasks. Theorem: A system T of independent, preemptable processes with relative deadlines equal to their periods can be feasibly scheduled on one processor iff its total utilization, U 1. Test for EDF algorithm: 1. pk. ESG Seminar p.25/42

Validation - Conclusions Numerous validation algorithms are available for different scheduling methods Some techniques are fast and suitable for on-line admission tests, others more robust Formal validation techniques used for providing Hard Real-Time guarantees In Srijan, our main emphasis is on soft real-time systems; thus validation will be mostly by testing and benchmarking However, since our focus is also on Vision-based applications, we might also deal with some formal validation techniques ESG Seminar p.26/42

Factors to be considered in workload model Non-preemptability Due to usage of a limited resource that must be mutually exclusiven Self-Suspension Invoking some external operation : I/O, remote procedure, etc. Context Switches In SPARC architecture (on which Leon is based), context switch time is significant due to register windows A crude estimate of Context Switch Time on leon: 64X3 10 25µsec 8µsec ESG Seminar p.27/42

Factors to be considered (contd) Limited-Priority Levels RTOS may have limited priority levels so, tasks (or jobs) may have nondistinct priorities However, in RtKer, we can define upto Maxint priority levels Tick Scheduling Events may not be incorporated instantaneously, since scheduler might be clock driven. Varying Priority in Fixed-Priority Systems Job might require different priorities in different segments (contention for resource etc.) ESG Seminar p.28/42

Outline of the Presentation Introduction to Real-Time Systems A Reference Model of Real-Time Systems Priority-driven Scheduling of Real-Time Systems An overview of Real-Time Kernel (RtKer) Conclusions ESG Seminar p.29/42

Introduction to RTKer The Basic RTKer Kernel supports Threads Semaphores Real-time interrupt handling Context switching Minimal C library for basic functions (printf/malloc) ESG Seminar p.30/42

Introduction (Cont d) The salient features of RTKer are : Two Stage Interrupt Handling - For minimum interrupt response time Pluggable Scheduler - User can add custom scheduling Modular design - Easy modification and porting ESG Seminar p.31/42

Interrupt Handling Interrupt Latency - Delay in execution of ISR from the time interrupt is raised Arises due to : Kernel s disabling of interrupts to protect data structures from ISRs Kernel s processing time to call the ISR Device driver s disabling of interrupts because of device specification requirement RTKer tries to reduce the latency arising out of need for protection of data structures ESG Seminar p.32/42

Interrupt Handling : RTKer RTKer supports two-stage interrupt handling routine to be registered Immediate ISR Bottom Half ISR Immediate ISR provides a mechanism for an immediate response Kernel library related functions are then postponed for the Bottom Half ISR ESG Seminar p.33/42

Interrupt Handling : RTKer vs Linux t0 t1 t2 Interrupt Bottom Half ISR ISR Immediate ISR Interrupt Kernel Critical Section Kernel Code Interrupt Handling Routine with system calls Immediate Interrupt Handler w/o system calls RTKer Linux ESG Seminar p.34/42

Device Driver Framework : RTKer Acceptability of any OS including RTOSes depends on the support for various peripherials RTKer solves the problem of support for devices as: RTKer uses device drivers from popular OSes like Linux Uses OSKIT device driver framework Interface of the OSKIT framework to device driver is through glue code ESG Seminar p.35/42

Threads Implementation struct tcb { };. struct reg_context thread_context;. struct tcb *recoverytask; u32_t magic_key; thread_context field is architecture specific and scheduler doesn t need to access it magic_key field is available for debugging purposes ESG Seminar p.36/42

Semaphores Implementation Integrity is maintained through spin locks Kernel maintains global queue for threads with timeouts Sem 1 Sem 2 Threads waiting with timeouts Threads w/o timeouts Global Queue ESG Seminar p.37/42

The Scheduler API : RTKer Functions defined within struct sched_info have to be implemented by user struct sched_info { sched_lock init }. heir_thread set_mode set_priority get_priority. ESG Seminar p.38/42

Implementation for Portability Device Drivers Hardware Dependent Code Threads Library Scheduler Application Hardware ESG Seminar p.39/42

Implementation for Portability (Cont d) Directory-wise separation for hardware dependent and hardware independent code with a clear API Only the hardware dependent functions need to be modified for porting to different architecture CPU Context Initialize CPU Context Switch rtker Init function C Library Boot strap Device Drivers ESG Seminar p.40/42

Outline of the Presentation Introduction to Real-Time Systems A Reference Model of Real-Time Systems Priority-driven Scheduling of Real-Time Systems An overview of Real-Time Kernel (RtKer) Conclusions ESG Seminar p.41/42

Outline of the Presentation Important issues in a Multiprocessor environment: Partitioning Scheduling Inter-process communication Work to be done on RtKer and in SPN ESG Seminar p.42/42