REAL-TIME OPERATING SYSTEMS SHORT OVERVIEW

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

Real-Time Systems. Real-Time Operating Systems

Real-Time Operating Systems

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

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

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

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

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

NuttX Realtime Programming

Embedded Systems. 6. Real-Time Operating Systems

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

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

Systemy RT i embedded Wykład 11 Systemy RTOS

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

RT extensions/applications of general-purpose OSs

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

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

Multimedia Systems 2011/2012

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

Operating system concepts. Task scheduling

Reference Model and Scheduling Policies for Real-Time Systems

Scheduling. Scheduling 1/51

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

Real-time Support in Operating Systems

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

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

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

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

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

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

The Real-time Specification for Java

CEC 450 Real-Time Systems

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

Scheduling. Scheduling 1/51

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

REAL TIME OPERATING SYSTEM PROGRAMMING-I: VxWorks

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

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

CS A331 Programming Language Concepts

6/17/2011. Real-time Operating Systems

Multiprocessor and Real-Time Scheduling. Chapter 10

Asynchronous Events on Linux

Main Points of the Computer Organization and System Software Module

Lecture 2 Process Management

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

Model Based Development of Embedded Control Software


Embedded Systems: OS

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

Operating System Architecture. CS3026 Operating Systems Lecture 03

Real-Time & Embedded Operating Systems

Timers 1 / 46. Jiffies. Potent and Evil Magic

10 th AUTOSAR Open Conference

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

Enriching Enea OSE for Better Predictability Support

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

Processes and Non-Preemptive Scheduling. Otto J. Anshus

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

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13

Microkernel/OS and Real-Time Scheduling

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

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

LINUX AND REALTIME 1

Green Hills Software, Inc.

Introduction to Embedded Systems

Real-time operating systems and scheduling

EMERALDS: a small-memory real-time microkernel

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

Lesson 5: Software for embedding in System- Part 2

Lecture 2: September 9

Exam Review TexPoint fonts used in EMF.

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

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

Chapter 3 Process Description and Control

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

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

CS 326: Operating Systems. CPU Scheduling. Lecture 6

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

CEC 450 Real-Time Systems

Quality-Assuring Scheduling in the Fiasco Microkernel

Operating Systems 2010/2011

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs:

CPU Scheduling (Part II)

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

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

Process Description and Control

Linux Xenomai UAV Sensor platform.

SE300 SWE Practices. Lecture 10 Introduction to Event- Driven Architectures. Tuesday, March 17, Sam Siewert

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

Lecture 12: An Overview of Scheduling Theory

SMD149 - Operating Systems

NPRG051 Advanced C++ Programming 2016/17 Assignment 2

BRDS ( , WS 2017) Ulrich Schmid

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

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

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

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

Real-time in embedded Linux systems

CS533 Concepts of Operating Systems. Jonathan Walpole

Transcription:

Faculty of Computer Science Institute of Systems Architecture, Operating Systems Group REAL-TIME OPERATING SYSTEMS SHORT OVERVIEW HERMANN HÄRTIG, WS 2017/18

OUTLINE Basic Variants of Real-Time Operating System Scheduling Memory Management Real-Time OS Examples POSIX and Real-Time???? DROPS: Dresden Real Time OS ARINC 653-1 Standard for Avionics 2

BASIC VARIANTS OF RTOSES (I) Simplest Cyclic Executive Only one task as infinite loop Time driven, polling for external events Set of Interrupt Handlers (as tasks ) Event driven Handlers have priorities Stack-based scheduling 3

BASIC VARIANTS OF RTOSES (II) Thread Packages (irmx, FreeRTOS, ecos,... ) provide some form of scheduling Preemptive or cooperative Priorities (fixed or EDF) Provide synchronization primitives (e.g., semaphores) Some with priority inheritance/ceiling No address-space protection, no virtual memory 4

BASIC VARIANTS OF RTOSES (III) Microkernels Memory protection (address spaces) With or Without page-based virtual memory More robustness (fault isolation) Extensive Functionality provided on top using collection of server or Non-RT-OS in a virtual machine examples: QNX, VxWorks, L4/Fiasco, 5

BASIC VARIANTS OF RTOSES (IV) Monolithic RTOS, Variant 1 Monolithic kernel with RT API (POSIX RT ) Often non-real-time APIs as well (e.g., Linux compatibility) Device drivers etc. usually run in kernel mode Real-time applications usually run in user mode examples: Linux-RT(preempt patch), LynxOS, 6

BASIC VARIANTS OF RTOSES (IV) Monolithic RTOS, Variant 2 RT Executive/ hypervisor underneath legacy Combination of a legacy OS with some form of an RT thread package (Usually no memory protection) Real-time applications run in kernel mode examples: RTLinux, RTAI, XtratuM 7

PARTITIONS AS SPECIAL CASE FOR TIME-DRIVEN (I) As we know: 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 8

PARTITIONS AS SPECIAL CASE FOR TIME-DRIVEN (II) Partitioned System Time Driven, Pike OS All resources are statically allocated to the partitions space: Cores, Memory, Devices, time: based on preallocated time-slots Multiple threads/processes in a partition Scheduling: Partitions: Time driven Threads/Processes: any local scheduling scheme possible 9

NON-REAL-TIME ON RTOS Non-RT API on RT Kernel: Unix emulation on QNX Linux emulation on LynxOS Xtratum, Windows-NT, RT-MACH, L4Linux on DROPS 10

OTHER RESOURCES Active resources besides CPU and Memory Disk, Network Bandwidth, Video, Addressed for example in Linux/RK, DROPS 11

MORE REQUIREMENTS FOR RT OS Time as First Class Citizen Periodic processes or absolute timeouts Interface: clock_gettime, clock_getres High clock resolution Special CPU event counters Non-periodic timers (dynamic ticks in Linux) Time synchronization 12

REAL-TIME SCHEDULING (I) Fixed Priorities Sufficient priority levels (e.g., RMS 256 prios [1]) Protocols to avoid Priority Inversion Events/Messages with priorities Higher priority events arrive first On some systems priority is donated to the receiver Signals are queued (predictability) 13

REAL-TIME SCHEDULING (II) Dynamic Priorities Application based: set_priority(p) Good for mode changes Not suitable for EDF OS driven EDF scheduling(linux: EDF sched class) What if processes abuse their priorities? Overload situations? Coop with NON-RT-Priorities?? 14

REAL-TIME SCHEDULING (III) Periodic Threads and Time Quanta (bandwidth servers) Scheduling Assign budgets per period to threads: Thread attribute -> (period, priority, budget) Control overuse of budgets Periodic threads as first class object Watchdog timers to signal budget overruns 15

INTERRUPT LATENCIES One important property of RTOSes: Low and predictable interrupt latency Interrupt latency reduction: No/short interrupt blocking for synchronization (preemptivity) Short interrupt service routines ( top halves ) Schedule more complex interrupt handling in a thread-like fashion Partition data and instruction caches 16

AVOID PRIORITY INVERSION Priority Ceiling Set priority of lock Critical sections as parameter for process creation Priority Inheritance Borrowing of CPU time and priority (Linux) Non-preemptive critical sections 17

REAL-TIME ON MODERN HARDWARE Increasing unpredictability through TLBs (MMU Caches) Caches Pipelining (write buffers) Multi-Master Busses Intelligent Devices 18

REAL-TIME AND MEMORY MANAGEMENT Avoid demand paging/swaping (disk access is orders of magnitude slower than main memory) However: Address space isolation needed for robustness/debugging Some scenarios need paging Interface mlock(...) lock pages in memory (prevent swapping) munlock(...) allow demand paging again 19

REAL-TIME AND MEMORY MANAGEMENT Static Memory Allocation Always good for real time Inflexible Dynamic Memory Management Use real-time capable memory allocator (e.g., [3] TLSF) Examples: RT-Java real-time garbage collection RT-Java with separation of static/dynamic 20

LONG I/O OPERATIONS Asynchronous I/O Example: POSIX (IEEE Std 1003.1) Initiate I/O aio_read(struct aiocb *aiocbp) aio_write(struct aiocb *aiocbp) POSIX Signals for completion aio_suspend(...) to wait for completion 21

LONG I/O OPERATIONS(II) 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 */ } 22

POSIX AND REAL-TIME POSIX (Portable OS Interface): IEEE 1003.1 REALTIME extensions: asynchronous I/O plus Semaphores Process Memory Locking Priority Scheduling Realtime Signal Extension Clocks/Timers Interprocess Communication 23

POSIX: MEMORY LOCKING Memory ranges can be locked (excluded from swaping) Provide latency guarantees for memory accesses 24

POSIX: REALTIME SCHEDULING Multiple scheduling policies SCHED_FIFO (non-preemptive FIFO) SCHED_RR (preemptive/time-sliced FIFO) SCHED_SPORADIC (2 prio levels, replenishment interval, and budget, FIFO on active priority level) SCHED_OTHER (threads without RT policy) At least 32 RT priorities 25

POSIX: REALTIME SIGNALS Difference to non-realtime signals: Queued (for the same 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 is delivered first 26

POSIX: REALTIME TIMERS/CLOCKS (I) Clocks Min. resolution 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 27

POSIX: REALTIME TIMERS/CLOCKS (II) Timers Associated to a specific clock (see Clocks) Per process timers (generate RT signals) Periodic timers supported (struct timespec) 28

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 29

POSIX: ASYNCHRONOUS I/O Explicitly overlap I/O operations and processing See Asynchronous I/O earlier slide 30

L4/FIASCO REAL-TIME SCHEDULING (I) Periodic mode for Real time execution Period defines deadline and minimum refresh interval for real-time scheduling contexts Multiple scheduling contexts per thread Scheduling context is tuple (Priority, Timeslice length) = Reservation Time slice overrun Thread exceeded reserved time quantum (reservation time) 31

L4/FIASCO REAL-TIME SCHEDULING (II) Time slice overrun and Deadline miss Signaled via IPC to a special preempter thread Execution models Strictly periodic (constant interrelease times) Periodic (minimal interrelease times) Sporadic (random interrelease time, hard deadline) Aperiodic (random interrelease time, no deadline) 32

ARINC 653-1 STANDARD FOR AVIONICS Statically partitioned System (time-driven scheduling) 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 33

TAKE AWAY the impact of RT-Theory on RTOS architectural alternatives lots of little things 34