Embedded Systems. 6. Real-Time Operating Systems

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

EMBEDDED OPERATING SYSTEMS

Embedded & Real-time Operating Systems Communication Libraries

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

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

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

RT extensions/applications of general-purpose OSs

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

6/17/2011. Real-time Operating Systems

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 OPERATING SYSTEM PROGRAMMING-I: VxWorks

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

Real-Time Systems. Real-Time Operating Systems

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

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

2. Introduction to Software for Embedded Systems

REAL-TIME OPERATING SYSTEMS SHORT OVERVIEW

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

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

Tasks. Task Implementation and management

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

Real-Time Systems 1. Basic Concepts


Multiprocessor and Real- Time Scheduling. Chapter 10

Analysis and Research on Improving Real-time Performance of Linux Kernel

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

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

Process Scheduling Queues

CS A331 Programming Language Concepts

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

(MCQZ-CS604 Operating Systems)

Real-time Support in Operating Systems

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

Systemy RT i embedded Wykład 11 Systemy RTOS

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

CSE 153 Design of Operating Systems

Operating Systems (1DT020 & 1TT802)

Operating Systems : Overview

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

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institute of Technology, Delhi. Lecture 23 Embedded OS

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

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

Embedded Software Programming

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

Real-Time Programming

For use by students enrolled in #71251 CSE430 Fall 2012 at Arizona State University. Do not use if not enrolled.

MARUTHI SCHOOL OF BANKING (MSB)

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Green Hills Software, Inc.

CSI3131 Final Exam Review

Page 1. Analogy: Problems: Operating Systems Lecture 7. Operating Systems Lecture 7

Operating Systems Overview. Chapter 2

Process Description and Control

Lesson 5: Software for embedding in System- Part 2

Deadlock. Lecture 4: Synchronization & Communication - Part 2. Necessary conditions. Deadlock handling. Hierarchical resource allocation

RTOS Real T i Time me Operating System System Concepts Part 2

Embedded Linux Architecture

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

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

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

Timers 1 / 46. Jiffies. Potent and Evil Magic

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

Reference Model and Scheduling Policies for Real-Time Systems

Chapter 5 Concurrency: Mutual Exclusion and Synchronization

Operating Systems. Lecture 4 - Concurrency and Synchronization. Master of Computer Science PUF - Hồ Chí Minh 2016/2017

EC EMBEDDED AND REAL TIME SYSTEMS

Real-Time Operating Systems

ECE519 Advanced Operating Systems

Chapter 13: I/O Systems

System Architecture Directions for Networked Sensors. Jason Hill et. al. A Presentation by Dhyanesh Narayanan MS, CS (Systems)

Concurrency, Mutual Exclusion and Synchronization C H A P T E R 5

operating system Spring 2017 Prof.Dr. Hasan Balik Student Name : Walid.W. Ramadan mansour Student ID :

Operating System Provides

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

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

message passing model

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

Module 12: I/O Systems

RT3 - FreeRTOS Real Time Programming

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Chapter 13: I/O Systems

Real-Time Programming

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Operating Systems Antonio Vivace revision 4 Licensed under GPLv3

SMD149 - Operating Systems

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

CS370 Operating Systems

Unit 2 : Computer and Operating System Structure

QUESTION BANK UNIT I

Chapter 3 Process Description and Control

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

Introduction to Real-Time Operating Systems

Exam Review TexPoint fonts used in EMF.

The Real-time Specification for Java

Processes and Threads. Processes and Threads. Processes (2) Processes (1)

Device-Functionality Progression

Chapter 12: I/O Systems. I/O Hardware

Transcription:

Embedded Systems 6. Real-Time Operating Systems Lothar Thiele 6-1

Contents of Course 1. Embedded Systems Introduction 2. Software Introduction 7. System Components 10. Models 3. Real-Time Models 4. Periodic/Aperiodic Tasks 5. Resource Sharing 8. Communication 9. Low Power Design 11. Architecture Synthesis 6. Real-Time OS Software and Programming 12. Model Based Design Processing and Communication Hardware 6-2

Embedded OS Why an OS at all? Same reasons why we need one for a traditional computer. Not all services are needed for any device. Large variety of requirements and environments: Critical applications with high functionality (medical applications, space shuttle, process automation, ). Critical applications with small functionality (ABS, pace maker, ) Not very critical applications with varying functionality (smart phone, smart card, microwave oven, ) 6-3

Embedded OS Why is a desktop OS not suited? Monolithic kernel is too feature reach. Monolithic kernel is not modular, fault-tolerant, configurable, modifiable,. Takes too much memory space. It is often too ressource hungry in terms of computation time. Not designed for mission-critical applications. Timing uncertainty too large. 6-4

Embedded Operating Systems Configurability No single RTOS will fit all needs, no overhead for unused functions/data tolerate: configurability is needed. For example, there are many embedded systems without external memory, a keyboard, a screen or a mouse. Configurability examples: Simplest form: remove unused functions (by linker for example). Conditional compilation (using #if and #ifdef commands). Validation is a potential problem of systems with a large number of derived operating systems: each derived operating system must be tested thoroughly; for example, ecos (open source RTOS from Red Hat) includes 100 to 200 configuration points. 6-5

http://www.windriver.com/products/development_tools/ide/tornado2/tornado_2_ds.pdf Example: Configuration of VxWorks 6-6 Windriver

Embedded operating systems Device drivers handled by tasks instead of hidden integrated drivers: Improve predictability; everything goes through scheduler Effectively no device that needs to be supported by all versions of the OS, except maybe the system timer. RTOS Standard OS 6-7

Embedded Operating Systems Interrupts can be employed by any process For standard OS: this would be serious source of unreliability. But embedded programs can be considered to be tested. It is possible to let interrupts directly start or stop tasks (by storing the tasks start address in the interrupt table). More efficient and predictable than going through OS interfaces and services. However, composability suffers: if a specific task is connected to some interrupt, it may be difficult to add another task which also needs to be started by the same event. If real-time processing is of concern, time to handle interrupts need to be considered. For example, interrupts may be handled by the scheduler. 6-8

Embedded Operating Systems Protection mechanisms are not always necessary: Embedded systems are typically designed for a single purpose, untested programs rarely loaded, software considered reliable. Privileged I/O instructions not necessary and tasks can do their own I/O. Example: Let switch be the address of some switch. Simply use load register,switch instead of a call to the underlying operating system. However, protection mechanisms may be needed for safety and security reasons. 6-9

Real-time Operating Systems A real-time operating system is an operating system that supports the construction of real-time systems. Three key requirements: 1. The timing behavior of the OS must be predictable. services of the OS: Upper bound on the execution time! RTOSs must be deterministic (unlike standard Java for example): upper bounds on blocking times need to be available, i.e. times during which interrupts are disabled, almost all processor activities are controlled by a real-time scheduler. 6-10

Task Management Services External interrupt Interrupt dispatch Interrupt service Timer interrupt Time service & events Scheduling & dispatcher Task execution System calls (trap) Services (create thread, sleep, notify, send, ) kernel 6-11

Real-time Operating Systems 2. OS must manage the timing and scheduling OS possibly has to be aware of deadlines; (unless scheduling is done off-line). OS must provide precise time services with high resolution. 3. The OS must be fast Practically important. 6-12

Main Functionality of RTOS-Kernels Task management: Execution of quasi-parallel tasks on a processor using processes or threads (lightweight process) by maintaining process states, process queuing, allowing for preemptive tasks (fast context switching) and quick interrupt handling CPU scheduling (guaranteeing deadlines, minimizing process waiting times, fairness in granting resources such as computing power) Process synchronization (critical sections, semaphores, monitors, mutual exclusion) Inter-process communication (buffering) Support of a real-time clock as an internal time reference 6-13

Task Management Task synchronization: In classical operating systems, synchronization and mutual exclusion is performed via semaphores and monitors. In real-time OS, special semaphores and a deep integration into scheduling is necessary (priority inheritance protocols,.). Further responsibilities: Initializations of internal data structures (tables, queues, task description blocks, semaphores, ) 6-14

Task States Minimal Set of Task States: terminate wait run end_cycle TIMER wait dispatch preemption idle activate signal ready resume 6-15

Task states Run: A task enters this state as it starts executing on the processor Ready: State of those tasks that are ready to execute but cannot be executed because the processor is assigned to another task. Wait: A task enters this state when it executes a synchronization primitive to wait for an event, e.g. a wait primitive on a semaphore. In this case, the task is inserted in a queue associated with the semaphore. The task at the head is resumed when the semaphore is unlocked by a signal primitive. Idle: A periodic job enters this state when it completes its execution and has to wait for the beginning of the next period. 6-16

Threads A thread is the smallest sequence of programmed instructions that can be managed independently by a scheduler; e.g., a thread is a basic unit of CPU utilization. Multiple threads can exist within the same process and share resources such as memory, while different processes do not share these resources: Typically shared by threads: memory. Typically owned by threads: registers, stack. Thread advantages and characteristics: Faster to switch between threads; switching between user-level threads requires no major intervention by the operating system. Typically, an application will have a separate thread for each distinct activity. Thread Control Block (TCB) stores information needed to manage and schedule a thread 6-17

Context Switching process control block 6-18

Multiple Threads within a Process 6-19

Communication Mechanisms Problem: the use of shared resources for implementing message passing schemes may cause priority inversion and blocking. 6-20

Communication mechanisms Synchronous communication: Whenever two tasks want to communicate they must be synchronized for a message transfer to take place (rendezvous) They have to wait for each other. Problem in case of dynamic real-time systems: Estimating the maximum blocking time for a process rendez-vous. In a static real-time environment, the problem can be solved off-line by transforming all synchronous interactions into precedence constraints. 6-21

Communication mechanisms Asynchronous communication: Tasks do not have to wait for each other The sender just deposits its message into a channel and continues its execution; similarly the receiver can directly access the message if at least a message has been deposited into the channel. More suited for real-time systems than synchronous comm. Mailbox: Shared memory buffer, FIFO-queue, basic operations are send and receive, usually has fixed capacity. Problem: Blocking behavior if channel is full or empty; alternative approach is provided by cyclical asynchronous buffers. Sender mailbox 6-22 Empfänger

Class 1: Fast Proprietary Kernels Fast proprietary kernels For hard real-time systems, these kernels are questionable, because they are designed to be fast, rather than to be predictable in every respect Examples include FreeRTOS, QNX, ecos, RT-LINUX, VxWORKS, LynxOS. 6-23

Class 2: Extensions to Standard OSs Real-time extensions to standard OS: Attempt to exploit comfortable main stream OS. RT-kernel running all RT-tasks. Standard-OS executed as one task. + Crash of standard-os does not affect RT-tasks; - RT-tasks cannot use Standard-OS services; less comfortable than expected revival of the concept: 6-24 and hypervisor Networks Laboratory

Example: Posix 1.b RT-extensions to Linux Standard scheduler can be replaced by POSIX scheduler implementing priorities for RT tasks RT-Task RT-Task Init Bash Mozilla POSIX 1.b scheduler Linux-Kernel driver I/O, interrupts Special RT-calls and standard OS calls available. Easy programming, no guarantee for meeting deadline Hardware 6-25

Example: RT Linux Init Bash Mozilla scheduler Linux-Kernel driver RT-Task RT-tasks cannot use standard OS calls. Commercially available from fsmlabs (www.fsmlabs.com) RT-Task interrupts I/O RT-Linux RT-Scheduler interrupts interrupts Hardware 6-26

Class 3: Research Systems Research systems trying to avoid limitations: Include L4, sel4, NICTA, ERIKA, SHARK Research issues: low overhead memory protection, temporal protection of computing resources RTOSes for on-chip multiprocessors quality of service (QoS) control (besides real-time constraints) formally verified kernel properties List of current real-time operating systems: http://en.wikipedia.org/wiki/comparison_of_real-time_operating_systems 6-27