Real-Time Systems. Real-Time Operating Systems

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

REAL-TIME OPERATING SYSTEMS SHORT OVERVIEW

Real-Time Operating Systems

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

Embedded Systems. 6. Real-Time Operating Systems

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

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

Implementing Task Schedulers (1) Real-Time and Embedded Systems (M) Lecture 10

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

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

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

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

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

NuttX Realtime Programming

Systemy RT i embedded Wykład 11 Systemy RTOS

Operating system concepts. Task scheduling

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

RT extensions/applications of general-purpose OSs

Reference Model and Scheduling Policies for Real-Time Systems

Resource Access Control (2) Real-Time and Embedded Systems (M) Lecture 14

* There are more than 100 hundred commercial RTOS with memory footprints from few hundred kilobytes to large multiprocessor systems

Real-time Support in Operating Systems

Multimedia Systems 2011/2012

Xen and the Art of Virtualization. CSE-291 (Cloud Computing) Fall 2016

LINUX AND REALTIME 1

Scheduling. Scheduling 1/51

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

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

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

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

Real-Time & Embedded Operating Systems

Lesson 5: Software for embedding in System- Part 2

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control


Multiprocessor and Real-Time Scheduling. Chapter 10

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

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

Chapter 3 Process Description and Control

Chapter 5: CPU Scheduling. Operating System Concepts 9 th Edit9on

Scheduling. Scheduling 1/51

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

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

Green Hills Software, Inc.

Interrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts

CEC 450 Real-Time Systems

INF1060: Introduction to Operating Systems and Data Communication. Pål Halvorsen. Wednesday, September 29, 2010

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

REAL TIME OPERATING SYSTEM PROGRAMMING-I: VxWorks

Operating System Architecture. CS3026 Operating Systems Lecture 03

Embedded Systems: OS

Module 8. Industrial Embedded and Communication Systems. Version 2 EE IIT, Kharagpur 1

OS Design Approaches. Roadmap. OS Design Approaches. Tevfik Koşar. Operating System Design and Implementation

The Real-time Specification for Java

6/17/2011. Real-time Operating Systems

Model Based Development of Embedded Control Software

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

NPRG051 Advanced C++ Programming 2016/17 Assignment 2

ELEC 377 Operating Systems. Week 1 Class 2

Enriching Enea OSE for Better Predictability Support

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

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

CSE 237A Middleware and Operating Systems. Tajana Simunic Rosing Department of Computer Science and Engineering University of California, San Diego.

Lecture 2: September 9

CSE 4/521 Introduction to Operating Systems. Lecture 29 Windows 7 (History, Design Principles, System Components, Programmer Interface) Summer 2018

Common Computer-System and OS Structures

Windows 7 Overview. Windows 7. Objectives. The History of Windows. CS140M Fall Lake 1

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

CS A331 Programming Language Concepts

The POSIX AIO interface consists of the following functions: Enqueue a write request. This is the asynchronous analog of write(2).

Real Time Operating System Support for Concurrency

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

Overview. Thread Packages. Threads The Thread Model (1) The Thread Model (2) The Thread Model (3) Thread Usage (1)

10 th AUTOSAR Open Conference

CSC Operating Systems Fall Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. August 27 th, 2009.

Announcements. Computer System Organization. Roadmap. Major OS Components. Processes. Tevfik Ko!ar. CSC Operating Systems Fall 2009

Task Scheduling of Real- Time Media Processing with Hardware-Assisted Virtualization Heikki Holopainen

Timers 1 / 46. Jiffies. Potent and Evil Magic

IT 540 Operating Systems ECE519 Advanced Operating Systems

Asynchronous Events on Linux

Handout. The ARM Instruction Set. Real Time Systems. Real Time Operating Systems. Real Time System Organization. Classification of Real Time Systems

Lecture 2 Process Management

SMD149 - Operating Systems

ZiLOG Real-Time Kernel Version 1.2.0

Microkernel/OS and Real-Time Scheduling

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005

CPU Scheduling (Part II)

Real-time in embedded Linux systems

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - II OS Structures. University at Buffalo. OS Design and Implementation

OS Design Approaches. Roadmap. System Calls. Tevfik Koşar. Operating System Design and Implementation. CSE 421/521 - Operating Systems Fall 2013

EMERALDS: a small-memory real-time microkernel

Task Grain Scheduling for Hypervisor-Based Embedded System

Main Points of the Computer Organization and System Software Module

MASTER'S THESIS. Proportional and Sporadic Scheduling in Real-Time Operating Systems. Mikael Bertlin. Luleå University of Technology

Process Description and Control

Real-Time Operating Systems Design and Implementation. LS 12, TU Dortmund

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

Outline. Introduction. Survey of Device Driver Management in Real-Time Operating Systems

POSIX in Real-Time. By Kevin M. Obenland 03/15/2001. Daniel Correia nºmec Carlos Guisado nºmec 49099

Transcription:

Real-Time Systems Real-Time Operating Systems Hermann Härtig WS 2018/19

Outline Introduction Basic variants of RTOSes Real-Time paradigms Common requirements for all RTOSes High level resources Non-Real-Time on RTOS Scheduling Memory Management Example POSIX and Real-Time 2

Basic Variants of RTOSes Cyclic Executive Only one task as infinite loop Time driven, polling for external events Set of Interrupt Handlers Event driven Handlers usually have priorities Stacked execution: see stack-based priority ceiling protocol 3

Basic Variants of RTOSes Thread Packages: irmx, FreeRTOS, ecos, Use a form of scheduling Preemptive or cooperative Priorities Provide synchronization primitives (e.g., semaphores) Some with priority inheritance/ceiling No address-space protection, no virtual memory 4

Basic Variants of RTOSes Microkernels: QNX, VxWorks, L4/Fiasco, Memory protection: address spaces With or without virtual memory More robustness (fault isolation) Extensive functionality provided by services 5

Basic Variants of RTOSes Monolithic RTOS: LynxOS, MontaVista Linux, Monolithic kernel with RT API, like POSIX RT Often non-real-time APIs as well, e.g., Linux compatibility Device drivers etc. usually run in privileged mode Real-time applications usually run in user mode Monolithic with RT executive underneath: RTLinux, RTAI, XtratuM, Combination of a legacy OS with some form of an RT thread package, usually without memory protection Real-time applications run in kernel mode 6

Basic Variants of RTOSes Partitioned System All resources are statically allocated to partitions: CPU, Memory, Devices Isolation in space and time Multiple threads/processes in a partition Scheduling: Partitions: time driven Threads/processes: any local scheduling scheme possible ARINC 653-1 standard for avionics 7

ARINC 653-1 standard for avionics Statically partitioned system (time-driven scheduling) 1 2 3 t t n n+1 t n+2 time Execution in one partition must not influence execution in another partition (strict isolation) Strictly time-driven scheduling of partitions No transfer of idle CPU time among partitions Additionally defines! System health monitoring! Intra/inter-partition communication! Time management 8

Virtual Machines and RT Hypervisor provides virtual machines with Guest OS Used as partitioned system Address space isolation within virtual machines Sometimes virtual machine is just marketing-speak for virtual memory Used to co-locate existing systems Can RT-Properties of Guest OS be preserved? No global scheduling, but hierarchical Enlightened VMs can use hints to influence global schedule 9

Common Requirement for RT Time as First Class Citizen Periodic processes or absolute timeouts POSIX Interface: clock_gettime, clock_getres High clock resolution necessary Special CPU event counters Linux: some clocks readable without system call Time synchronization 10

High-Level Resources RT is often reduced to CPU scheduling and latencies There are more resources to give guarantees about: Disk, Video, Network, Operating systems addressing these are Linux/RK (resource kernel) Redline L4/DROPS 11

Non-Real-Time on RTOS Non-RT API on RT kernel Unix emulation on QNX Linux emulation on LynxOS Run Non-RT OS on RT kernel Xtratum Radisys (Windows-NT) RT-MACH L4Linux on L4 12

Scheduling in Real-Time OSes Priorities Priority inversion and countermeasures Time budgets Interrupt / event latencies 13

Real-Time Scheduling Fixed Priorities Sufficient priority levels (e.g., RMS 256 priorities) Events/messages with priorities Higher priority events arrive first On some systems priority is donated to the receiver Signals are queued (predictability) 14

Real-Time Scheduling Dynamic Priorities Application based: set_priority Good for mode changes Not suitable for EDF OS-driven EDF scheduling 15

Scheduling Priority Inversion Priority Ceiling Set priority of lock Critical sections as parameter for process creation Priority Inheritance Borrowing of CPU time (priority) Non-preemptive critical sections 16

Scheduling Budgets What if processes abuse their priorities? Overload situations? Periodic threads and time quanta Assign budgets per period to threads: thread = (period, priority, budget) Control overuse of budgets: Periodic threads as first class object Watchdog timers to signal budget overruns 17

Interrupt Latencies Key Property of RTOSes: Predictable and low interrupt latency Interrupt Latency Reduction No interrupt blocking for synchronization (preemptivity) Short interrupt service routines ( top halves ) Schedule more complex interrupt handling in a thread-like fashion (Linux: tasklets) Partition data and instruction caches 18

Real-Time and Memory Management Avoid demand paging/swaping (disk access is orders of magnitude slower than main memory) However: Address space isolation useful for robustness/debugging Some scenarios need paging Interface mlock( ) lock pages in memory (prevent swaping) munlock( ) allow demand paging again 19

Real-Time and Memory Management Static Memory Allocation Good for predictability Inflexible Dynamic memory management Use real-time capable memory allocator e.g. TLSF 20

POSIX and Real-Time POSIX (Portable OS Interface): IEEE 1003.1 REALTIME extensions semaphores process memory locking priority scheduling realtime signal extension clocks/timers interprocess communication synchronized I/O asynchronous I/O 21

POSIX: Memory Locking Memory ranges can be locked (excluded from swaping) Provide latency guarantees for memory accesses 22

POSIX: Real-Time Scheduling Multiple scheduling policies SCHED_FIFO: non-preemptive FIFO SCHED_RR: preemptive/time-sliced FIFO SCHED_SPORADIC: sporadic server with budget and replenishment interval SCHED_OTHER: threads without RT policy At least 32 RT priorities 23

POSIX: Real-Time Signals Difference to non-realtime signals: Queued (also for the same signal number) Carry user data Ordered delivery Specific properties RT signals are in the range SIGRTMIN to SIGRTMAX Handler gets siginfo_t with additional data Lowest pending signal (by number) is delivered first 24

POSIX: Asynchronous I/O Initiate I/O aio_read(struct aiocb *aiocbp) aio_write(struct aiocb *aiocbp) POSIX signals for completion aio_suspend( ) to wait for completion 25

POSIX: Asynchronous I/O struct aiocbp { Int aio_filedes; /* file descriptor */ off_t aio_offset; /* absolute file offset */ Void *aio_buf; /* pointer to memory buffer */ size_t aio_nbytes; /* number of bytes to I/O */ Int aio_reqprio; /* prio of request */ struct sigevent aio_sigevent; /* signal */ Int aio_lio_opcode; /* opcode for lio_listio */ }; 26

POSIX: Real-Time Clocks Clocks Minimum granularity of 20ms (clock_getres()) Multiple clocks CLOCK_REALTIME (wall clock time) CLOCK_MONOTONIC (system-wide monotonic clock) CLOCK_PROCESS_CPUTIME_ID CLOCK_THREAD_CPUTIME_ID Timers Associated to a specific clock (see Clocks) Per process timers (generate RT signals) Periodic timers supported (struct timespec) 27

POSIX: Execution Time Monitoring Clocks measuring thread/process execution time CLOCK_PROCESS_CPUTIME_ID CLOCK_THREAD_CPUTIME_ID Timers connected to these clocks Signal deadline misses 28

Real-Time Paradigms Time driven Static partitioning in time slots Scheduler dispatches time slots in a fixed fashion (e.g., fixed cyclic scheduler) Event driven Events: messages, signals, interrupts, Priorities 29