EE458 - Embedded Systems Lecture 5 Intro to RTOSes

Similar documents
Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Embedded Systems. 6. Real-Time Operating Systems

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2)

REAL TIME OPERATING SYSTEMS. Lesson-10:

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

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

The Real-Time Operating System ucos-ii

Performance Comparison of RTOS

Operating Systems. Lecture 03. February 11, 2013

Weighted Total Mark. Weighted Exam Mark

Scheduling and Thread Management with RTEMS

CPU Scheduling. CPU Scheduling

SYSTEM ecos Embedded Configurable Operating System

OPERATING SYSTEMS SCHEDULING

Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

Programming real-time systems with C/C++ and POSIX

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Chapter 19: Real-Time Systems. Overview of Real-Time Systems. Objectives. System Characteristics. Features of Real-Time Systems

CPU Scheduling Outline

Chapter 13 Embedded Operating Systems

Chapter 2: OS Overview

Predictable response times in event-driven real-time systems

Lecture 3 Theoretical Foundations of RTOS

Real-Time Operating Systems.

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Real-Time Operating Systems With Example PICOS18. What is an Operating System?

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

LynxOS RTOS (Real-Time Operating System)

Hard Real-Time Linux

Linux A multi-purpose executive support for civil avionics applications?

W4118 Operating Systems. Instructor: Junfeng Yang

Chapter 5 Process Scheduling

Operating Systems. III. Scheduling.

Operating Systems 4 th Class

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Real Time Operating System for Embedded DSP Applications

Device Management Functions

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

First-class User Level Threads

RTOS Debugger for ecos

Chapter 12. Development Tools for Microcontroller Applications

Real Time Programming: Concepts

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

Tasks Schedule Analysis in RTAI/Linux-GPL

Chapter 6, The Operating System Machine Level

PikeOS: Multi-Core RTOS for IMA. Dr. Sergey Tverdyshev SYSGO AG , Moscow

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

Comparison between scheduling algorithms in RTLinux and VxWorks

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Operating System Manual. Realtime Communication System for netx. Kernel API Function Reference.

Operating Systems. Module Descriptor

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Linux scheduler history. We will be talking about the O(1) scheduler

Announcements. Basic Concepts. Histogram of Typical CPU- Burst Times. Dispatcher. CPU Scheduler. Burst Cycle. Reading

RTAI. Antonio Barbalace (modified by M.Moro 2011) RTAI

the high-performance embedded kernel User Guide Version 5.0 Express Logic, Inc Toll Free 888.THREADX FAX

Operating Systems, 6 th ed. Test Bank Chapter 7

CPU Scheduling. Core Definitions

Outline: Operating Systems

W4118 Operating Systems. Instructor: Junfeng Yang

Job Scheduling Model

INtime 4.0 Software September 2009

Lesson-16: Real time clock DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK

Gildart Haase School of Computer Sciences and Engineering

快 速 porting μc/os-ii 及 driver 解 說

CHAPTER 1: OPERATING SYSTEM FUNDAMENTALS

CS161: Operating Systems

2. is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput

Linux Process Scheduling Policy

CS0206 OPERATING SYSTEMS Prerequisite CS0201, CS0203

Linux 2.4. Linux. Windows

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Process Scheduling CS 241. February 24, Copyright University of Illinois CS 241 Staff

CS222: Systems Programming

Outline. Introduction. Multiprocessor Systems on Chip. A MPSoC Example: Nexperia DVP. A New Paradigm: Network on Chip

Processor Scheduling. Queues Recall OS maintains various queues

Operating System: Scheduling

Notes and terms of conditions. Vendor shall note the following terms and conditions/ information before they submit their quote.

Priority Inversion Problem and Deadlock Situations

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

Operatin g Systems: Internals and Design Principle s. Chapter 10 Multiprocessor and Real-Time Scheduling Seventh Edition By William Stallings

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling

theguard! ApplicationManager System Windows Data Collector

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Readings for this topic: Silberschatz/Galvin/Gagne Chapter 5

Real Time Operating Systems. Tajana Simunic Rosing Department of Computer Science and Engineering University of California, San Diego.

Convenience: An OS makes a computer more convenient to use. Efficiency: An OS allows the computer system resources to be used in an efficient manner.

The network we see so far. Internet Best Effort Service. Is best-effort good enough? An Audio Example. Network Support for Playback

Chapter 3 Operating-System Structures

Scheduling 0 : Levels. High level scheduling: Medium level scheduling: Low level scheduling

Networking Operating Systems (CO32010)

ICS Principles of Operating Systems

Design and Implementation of the Heterogeneous Multikernel Operating System

Lecture Outline Overview of real-time scheduling algorithms Outline relative strengths, weaknesses

Transcription:

EE458 - Embedded Systems Lecture 5 Intro to RTOSes Outline RTOS Components Multitasking Objects Services Key Characteristics of an RTOS RTEMS Key Concepts References RTC: Chapter 4 CUG: Chapter 2 1

Introduction to RTOSes There are many similarities between modern RTOSes and GPOSes: support for multitasking software and hardware resource management providing OS services to applications abstract the hardware from the software 2

Introduction to RTOSes But there are differences too. RTOSes have: better reliability in embedded applications the ability to scale up or down better performance reduced memory requirements scheduling policies tailored for embedded apps support for diskless systems better portability to different hardware platforms 3

Introduction to RTOSes An RTOS consists of a kernel that provides core services plus modules for networking, device I/O, filesystem access, etc. The kernel consists of the following: scheduler: determines which tasks execute when and for how long. objects: tasks, semaphores, queues, timers, etc services: interrupt, device, time, and memory management 4

The Scheduler The scheduler allocates time to schedulable entities which are also known as independent threads of executions (tasks and processes). Tasks are independent threads of execution that share a common memory space. Tasks are supported in most RTOSes. Processes run in separate memory spaces. This memory protection comes at the expense of performance. Processes are supported by only a few RTOSes. 5

Multitasking Note: Different terminology is used with GPOSes. A RTOS task is more commonly called a thread in a GPOS. The kernel handles multiple tasks by multitasking. Different tasks appear to be running concurrently. The kernel is actually interleaving task segments sequentially. 6

Context Switches Tasks are interleaved according to a preset scheduling algorithm. A context switch occurs when the scheduler switches from one task to another. A task control block (TCB) is created every time a new task is created. When a task is stopped all context information (CPU registers, IP, SP) is saved in the TCB. 7

Context Switches When a new task is started the context is restored from the task's TCB. A task switch may occur any time a task makes a system call, when an interrupt service routing (ISR) completes or under other conditions as determined by the scheduling algorithm. The dispatcher is the specific part of the scheduler that performs context switching. 8

Scheduling Algorithms Most kernels support two common scheduling algorithms: preemptive priority-based scheduling round-robin scheduling Depending on the RTOS these may be known by different names. Many RTOSes allow the scheduling algorithms to be configured to fit the needs of the application. 9

Priority-Based Scheduling In premptive priority-based scheduling each task is assigned a priority. The task with the highest priority that is ready to run is executed. Most RTOSes support 256 levels. Usually priority 0 is the highest and 255 is the lowest. Tasks are assigned priorities when they are created. The OS provides system calls which can be used to change the priority. 10

Priority-Based Scheduling HIGH Premption Task 3 Task Completion Task Priority Task 2 Task 2 LOW Task 1 Task 1 Time 11

Round Robin Scheduling With true round-robin scheduling each task would receive an equal share (a time slice) of CPU time. This cannot satisfy real-time system requirements. RTOSes augment round-robin scheduling with preemptive priority-based scheduling. Tasks of the same priority execute for a time slice in an ongoing cycle. A higher priority task may preempt a lower priority task at any time. 12

Round Robin Scheduling HIGH Task Priority Premption Task 4 Task Completion LOW Task 1 Task 2 T3 T3 Task 1 Time 13

Objects Kernel objects are the building blocks for application development. The most common RTOS objects are: tasks: threads of execution that compete for CPU time. semaphores: tokens that can be used by tasks for synchronization and mutual exclusion. message queues: buffers that can be used for synchronization, mutual exclusion and data exchange between tasks. 14

Services Most kernels provide services that help developers create applications for real-time embedded systems. These services are usually provided through sets of API calls. Typical services perform operations on kernel objects or facilitate timer management, interrupt handling, device I/O, and memory management. 15

Key Characteristics of an RTOS Some of the more common attributes of an RTOS are: reliability predictability performance compactness scalability 16

Key Characteristics of an RTOS Reliability Different applications require different levels of reliability. Reliability depends on the hardware, the BSP, the RTOS, and the application. Predictability OS calls are always completed within a given timeframe. (Deterministic) Performance A function of both the processor and the RTOS. CPU performance is measured in MIPS. Data transfer rates in bps (bits per second). 17

Key Characteristics of an RTOS Compactness In most embedded systems the amount of system memory is limited by size and/or cost. The RTOS must be small and efficient. Scalability Most RTOSes can scale up or down to meet application requirements. This allows the same RTOS to be used in very different applications. Modular components can be added or deleted in the RTOS. 18

Intro to RTEMS: Key Concepts All RTEMS objects have an RTEMS assigned ID and a user assigned name. An object name is a 32 bit entity. The data type rtems_name is used to store the name. You could use a 32 bit integer as a name, but the rtems_build_name() routine allows you to assign a meaningful name to the object: rtems_object_name myname; myname = rtems_build_name('t','s','k','1'); 19

Intro to RTEMS: Key Concepts An object ID is a unique 32 bit entity composed of four parts: class, api, node, and index. The data type rtems_id is used to store object IDs. class indicates the object type (task, queue, etc). The api indicates the API to which the object belongs (classic, POSIX, ITRON). The node is the processor on which the object is defined. The index identifies a particular object of a given class on a given node. 20

Intro to RTEMS: Key Concepts All RTEMS directives (system calls) involving objects require the ID as an argument. The ID is returned when an object is created so it is not usually necessary to refer to an object by name in a single processor application. Identification directives (task_ident(), semaphore_ident()) are provided to find an object's ID based on its name and node. 21

Intro to RTEMS: Key Concepts RTEMS provides the following managers for task synchronization and communication: Semaphore: mutual exclusion, priority inheritance Message Queue: sychronization and communcations Event: high performance synchronization Signal: asynchronous communication primarily used for exception handling 22

Intro to RTEMS: Key Concepts RTEMS provides support for several time related operations. The basic unit of time is known as a tick. The tick default time is BSP dependent. All time intervals are specified as multiples of the tick time. Each task automatically has one sleep timer at its disposal. The timer manager can be used to create other timers as required. 23

Intro to RTEMS: Key Concepts RTEMS provides three memory managers: partition: manages fixed size memory blocks Region: manages dynamically allocated, variable-size memory blocks Dual Ported: manages shared-memory for multiprocessor applications 24