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

Similar documents
REAL-TIME OVERVIEW SO FAR MICHAEL ROITZSCH. talked about in-kernel building blocks:

PROBABILISTIC SCHEDULING MICHAEL ROITZSCH

THREADS ADMINISTRIVIA RECAP ALTERNATIVE 2 EXERCISES PAPER READING MICHAEL ROITZSCH 2

RESOURCE MANAGEMENT MICHAEL ROITZSCH

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

REAL-TIME OPERATING SYSTEMS SHORT OVERVIEW

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

Real-Time Systems. Real-Time Operating Systems

Learning Outcomes. Scheduling. Is scheduling important? What is Scheduling? Application Behaviour. Is scheduling important?

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

Copyright Notice. COMP9242 Advanced Operating Systems S2/2014 Week 9: Real-Time Systems. Real-Time System: Definition

OVERVIEW. Last Week: But if frequency of high priority task increases temporarily, system may encounter overload: Today: Slide 1. Slide 3.

238P: Operating Systems. Lecture 14: Process scheduling

Multiprocessor Systems. COMP s1

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

Reservation-Based Scheduling for IRQ Threads

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

Scheduling II. Today. Next Time. ! Proportional-share scheduling! Multilevel-feedback queue! Multiprocessor scheduling. !

Computer Science Window-Constrained Process Scheduling for Linux Systems

Multiprocessor System. Multiprocessor Systems. Bus Based UMA. Types of Multiprocessors (MPs) Cache Consistency. Bus Based UMA. Chapter 8, 8.

Multiprocessor Systems. Chapter 8, 8.1

EMERALDS: a small-memory real-time microkernel

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

Analyzing Real-Time Systems

Multiprocessor and Real-Time Scheduling. Chapter 10

Real-Time Operating Systems

CS370 Operating Systems

Multiprocessor and Real- Time Scheduling. Chapter 10

Multimedia Systems 2011/2012

Real-time Support in Operating Systems

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

Reference Model and Scheduling Policies for Real-Time Systems

CS A331 Programming Language Concepts

Scheduling. Scheduling 1/51

Scheduling Algorithm and Analysis

Scheduling. Scheduling 1/51

Microkernel/OS and Real-Time Scheduling

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

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

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

Microkernel Construction

Scheduling, part 2. Don Porter CSE 506

Lecture: Embedded Software Architectures

CEC 450 Real-Time Systems

Computer Systems Assignment 4: Scheduling and I/O

Exam Review TexPoint fonts used in EMF.

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

A TimeSys Perspective on the Linux Preemptible Kernel Version 1.0. White Paper

L4-Linux Based System As A Platform For EPICS ioccore

Introduction to Embedded Systems

CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable)

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

Tasks. Task Implementation and management

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

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

Scheduling Mar. 19, 2018

Providing Real-Time and Fault Tolerance for CORBA Applications

Embedded Systems: OS

CEC 450 Real-Time Systems

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13

A Fully Preemptive Multiprocessor Semaphore Protocol for Latency-Sensitive Real-Time Applications

Real-Time and Concurrent Programming Lecture 6 (F6): Scheduling and bounded response times

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

6/17/2011. Real-time Operating Systems

Notes based on prof. Morris's lecture on scheduling (6.824, fall'02).

A Synchronous IPC Protocol for Predictable Access to Shared Resources in Mixed-Criticality Systems

CS A320 Operating Systems for Engineers

ò mm_struct represents an address space in kernel ò task represents a thread in the kernel ò A task points to 0 or 1 mm_structs

Operating Systems ECE344. Ding Yuan

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

Scheduling. Don Porter CSE 306

Priya Narasimhan. Assistant Professor of ECE and CS Carnegie Mellon University Pittsburgh, PA

RT extensions/applications of general-purpose OSs

But this will not be complete (no book covers 100%) So consider it a rough approximation Last lecture OSPP Sections 3.1 and 4.1

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Example Networks on chip Freescale: MPC Telematics chip

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Ensuring Schedulability of Spacecraft Flight Software

15: OS Scheduling and Buffering

Operating Systems and Networks Assignment 9

LECTURE 3:CPU SCHEDULING

Quality-Assuring Scheduling in the Fiasco Microkernel

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

Scheduling II. q q q q. Proportional-share scheduling Multilevel-feedback queue Multiprocessor scheduling Next Time: Memory management

Green Hills Software, Inc.

CPU Scheduling: Objectives

Predictable Interrupt Management and Scheduling in the Composite Component-based System

RTOS overview. Basic concepts and benefits

CSE 120 Principles of Operating Systems

Schedulability with resource sharing. Priority inheritance protocol Priority ceiling protocol Stack resource policy

PROCESS SCHEDULING Operating Systems Design Euiseong Seo

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

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

Recap. Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones

CSE120 Principles of Operating Systems. Prof Yuanyuan (YY) Zhou Scheduling

8: Scheduling. Scheduling. Mark Handley

Verification of Real-Time Systems Resource Sharing

Chapter 5: CPU Scheduling

Lecture 2: September 9

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

Transcription:

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

SO FAR talked about in-kernel building blocks: threads memory IPC drivers enable access to a wide range of non-kernel resources need to manage resources 3 COURSE EIP Applications System Services Basic Abstractions 4

RESOURCES Disk Bandwidth Network I/O TCP/IP Sessions Windows Semaphores Files Memory Threads Communication Rights 5 TIME 6

COMPARISON Memory Time discrete, limited continuous, infinite hidden in the system user-perceivable managed by pager managed by scheduler page-granular partitions arbitrary granularity all pages are of equal value value depends on workload active policy decisions, passive enforcement hierarchical management active policy decisions, active enforcement Fiasco: flattened in-kernel view 7 HISTORY in the early years of computing: time coarsely managed by batch systems jobs receive the entire machine or a dedicated part of it for a given time accounting, budgeting no preemption no interaction, good utilization still prevalent in HPC systems 8

THREADS today: threads provide a CPU abstraction each thread should observe its own time as continuous if there are more threads than physical CPU cores, we have to multiplex enforced by preemption implemented with timer interrupt 9 PROGRESS thread progress wall-clock time 10

REAL-TIME 11 DEFINITION a real-time system denotes a system, whose correctness depends on the timely delivery of results it matters, when a result is produced real-time denotes a predictable relation between system progress and wall-clock time 12

INTUITION real-time is about predictability guarantees timeliness responsiveness real-time is not about being fast live calculations 13 game engines NON-EXAMPLE rendered frames are delivered at instances of wall-clock time, but there is no guaranteed (minimal) frame-rate rendering times are not even predictable guaranteed responsiveness? game engines are just fast (hopefully), but not real-time 14

EXAMPLES engine control in a car break-by-wire avionics railway control set-top box DVD player GSM-stack in your cell phone focused catastrophic failures benign failures complex 15 FLAVORS hard real-time firm real-time soft real-time missing some deadlines is tolerable a result delivered after its deadline is still useful 16

THEMES ➀ Predictability ➁ Guarantees ➂ Enforcement 17 PREDICTABILITY 18

ENEMIES gap between worst and average case memory caches, disk caches, TLBs smart hardware system management mode disk request reordering cross-talk from resource sharing servers showing O(n) behavior unpredictable external influences interrupts 19 CROSSCUTTING Applications Realtime System Services Kernel Hardware 20

CUSTOM RTOS small real-time executives tailor-made for specific applications fixed workload known a priori pre-calculated time-driven schedule used on small embedded controllers benign hardware 21 RTLINUX full Linux kernel and real-time processes run side-by-side small real-time executive underneath supports scheduling and IPC real-time processes implemented as kernel modules all of this runs in kernel mode no isolation 22

XNU the kernel used in Mac OS X implements four priority bands normal system high priority kernel threads real-time threads you tell the kernel: I need A out of the next B cycles, can be contiguous 23 XNU normal users can create real-time threads threads exceeding their quantum will be demoted with the first real-time thread, the kernel switches from using continuations to full preemptibility all drivers need to handle interrupts correctly 24

FIASCO static thread priorities bounded interrupt latency fully preemptible in kernel mode lock-free synchronization uses atomic operations wait-free synchronization locking with helping instead of blocking 25 SKEPTICISM architecture for those afraid of touching the OS example: Real-Time Java Applications Real-Time Middleware Non-Real-Time Kernel 26

RESOURCES a real-time kernel alone is not enough the microkernel solution: real-time kernel enables temporal isolation eliminates cross-talk and interrupt problems user-level servers on top act as resource managers implement real-time views on specific resources real-time is not only about CPU details in the resource management lecture 27 GUARANTEES 28

PROBLEM worst case execution time (WCET) largely exceeds average case offering guarantees for the worst case will waste lots of resources missing some deadlines can be tolerated with the firm and soft real-time scheme 29 MOTIVATION desktop real-time there are no hard real-time applications on desktops there is a lot of firm and soft real-time low-latency audio processing smooth video playback desktop effects user interface responsiveness 30

H.264 DECODING 15% 10% 5% 0% WCET 0 5 10 15 20 25 30 ms 31 KEY IDEA guarantees even slightly below 100% of WCET can dramatically reduce resource allocation unused reservations will be used by others at runtime use probabilistic planning to model the actual execution quality q: fraction of deadlines to be met 32

KEY IDEA WCET 33 RESERVATION J r J P(J does not run longer than r J is completed until its relative deadline) q 34

RESERVATION r i = min(r R r i = max(r i, w i ) i = 1,..., n to fully understand this: see real-time systems lecture 1 m i m i k=1 P(X i +k Y i r) q i ) good for microkernel: reservation can be calculated by a userland service kernel only needs to support static priorities 35 SCHEDULING scheduling = admission + dispatch admission evaluates the requests from clients, which follow some task model calculates task parameters for dispatcher verifies the feasibility of the guarantees can reject requests dispatch executes and enforces the schedule 36

ENFORCEMENT 37 DISPATCHER executes schedule enforces task parameters by preemption e.g. on deadline overrun picks the next thread static priorities (e.g. RMS, DMS) dynamic priorities (e.g. EDF) seems simple 38

PROBLEM high priority thread calls low priority service with a medium priority thread interfering: Priority Thread 1 Thread 2 Thread 3 1 waits for 3 3 waits for 2 = 1 waits for 2 Priority Inversion 39 SOLUTION priority inheritance, priority ceiling nice mechanism for this in Fiasco, NOVA: timeslice donation implemented by splitting thread control block execution context: holds CPU statue scheduling context: time and priority on IPC-caused thread switch, only the execution context is switched 40

DONATING CALL Priority Thread 1 Thread 2 Thread 3 IPC receiver runs on the sender s scheduling context priority inversion problem solved with priority inheritance 41 ACCOUNTING servers run on their clients time slice when the server executes on behalf of a client, the client pays with its own time this allows for servers with no scheduling context server has no time or priority on its own can only execute on client s time relieves dispatcher from dealing with servers 42

TIMELESS servers could be malicious, so you need timeouts to get your time back now, malicious clients can call the server with a very short timeout server s time will be withdrawn while the server is in the middle of request handling servers need to do session cleanup on whose time? open research problem 43 SMP timeslice donation does not work in multiprocessor case: server is running on a different CPU cross-cpu donation would be needed you cannot donate time between CPUs think of real-time guarantees if one CPU is 100% loaded, donating time to it will overload it servers need to migrate to client CPU? 44

OPTIMIZATION 45 SEMAPHORES Thread 1 down up Semaphore Thread Thread 2 down enqueue and block dequeue and unblock up IPC only in the contention case optimized for low contention bad for producer-consumer (high contention) 46

SCENARIO consumer request wakeup: set flag, enqueue block producer check for wakeup: test flag, dequeue send wakeup very short critical sections semaphores too expensive (2 IPCs) 47 IDEA allow threads to have short periods where they are never preempted like a very low cost global system lock delayed preemption threads can set don t preempt me flag in UTCB very low cost 48

PROBLEMS unbounded delay if preemption would occur, the kernel honors the delayed preemption flag only for a fixed maximum delay delay affects all threads problematic for real-time guarantees affected threads can be limited to those within a priority band other threads can still preempt any time 49 BEWARE system must be designed carefully threads outside the affected priority band must not interfere with protected data structures more problems unaffected threads might donate time to a thread within the priority band does not work cross-cpu 50

managing time is necessary SUMMARY we interact with the system based on time real-time is a cross-cutting concern hard real-time is hard, soft real-time is even harder priority inheritance by timeslice donation delayed preemption next week: names 51