Microprocesors, Advanced What You Need to Know About RTOSes

Slides:



Advertisements
Similar presentations
Threads, SMP, and Microkernels
Advertisements

The eCos real-time operating system an open source tool to create embedded kernels and applications.
Real-Time Library: RTX
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
CSE Fall Introduction - 1 What is an Embedded Systems  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)
Real-Time Operating Systems Suzanne Rivoire November 20, 2002
Performance Evaluation of Real-Time Operating Systems
ΜC/OS-III Tasks Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Advanced Embedded Systems Design Pre-emptive scheduler BAE 5030 Fall 2004 Roshani Jayasekara Biosystems and Agricultural Engineering Oklahoma State University.
Real Time Operating System
Scheduling Basic scheduling policies, for OS schedulers (threads, tasks, processes) or thread library schedulers Review of Context Switching overheads.
Getting Started with the µC/OS-III Real Time Kernel Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
2-1 The critical section –A piece of code which cannot be interrupted during execution Cases of critical sections –Modifying a block of memory shared by.
Multiprogramming. Readings r Silberschatz, Galvin, Gagne, “Operating System Concepts”, 8 th edition: Chapter 3.1, 3.2.
Microprocesors, Advanced W hat You Need to Know About RTOSes February 1, 2012 Jack Ganssle.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
Overview Task State Diagram Task Priority Idle Hook AND Co-Routines
Embedded Systems OS. Reference Materials The Concise Handbook of Real- Time Systems TimeSys Corporation.
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
Real Time Operating Systems Michael Thomas Date: Rev. 1.00Date.
Multi-Tasking The Multi-Tasking service is offered by VxWorks with its real- time kernel “WIND”.
MicroC/OS-II S O T R.  MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2.  It.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
CSCI1600: Embedded and Real Time Software Lecture 17: Concurrent Programming Steven Reiss, Fall 2015.
Where Testing Fails …. Problem Areas Stack Overflow Race Conditions Deadlock Timing Reentrancy.
SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 1 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Big Picture Lab 4 Operating Systems C Andras Moritz
Chapter 1: Getting Started with μC/OS-II 1. kernel Introduction 2 LinuxμC/OS-II Task (process) kernel Device driver User mode (0-3G) (Kernel mode) 3G-4G.
Real-Time Operating Systems RTOS For Embedded systems.
LPC2148's RTOS Bruce Chhuon 4/10/07. What is a Real Time Operating System? ● A Real Time Operating System (RTOS) manages hardware and software resources.
Introduction to Operating Systems Concepts
Introduction to Real-Time Operating Systems
Chapter 1: Getting Started with μC/OS-II
REAL-TIME OPERATING SYSTEMS
Advanced Operating Systems CIS 720
CS501 Advanced Computer Architecture
CS 6560: Operating Systems Design
Topics Covered What is Real Time Operating System (RTOS)
Safe Queue? … while (next(head) == tail); // block if full
Interrupt and Time Management in µC/OS-III
REAL TIME OPERATING SYSTEM
Getting Started with the µC/OS-III Real Time Kernel
CSE 466 – Fall Introduction - 1
Threads, SMP, and Microkernels
ICS 143 Principles of Operating Systems
An Embedded Software Primer
Introduction What is an operating system bootstrap
Fundamentals of Computer Organisation & Architecture
Mid Term review CSC345.
Lecture Topics: 11/1 General Operating System Concepts Processes
Lecture 4- Threads, SMP, and Microkernels
Using Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Processes and operating systems
EE 472 – Embedded Systems Dr. Shwetak Patel.
CSCI1600: Embedded and Real Time Software
February 5, 2004 Adrienne Noble
CS703 - Advanced Operating Systems
CS510 Operating System Foundations
System Calls System calls are the user API to the OS
Process.
CSCI1600: Embedded and Real Time Software
Computer System Laboratory
Embedded System Development Lecture 12 4/4/2007
Akos Ledeczi EECE 6354, Fall 2017 Vanderbilt University
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Microprocesors, Advanced What You Need to Know About RTOSes February 1, 2012 Jack Ganssle

The RTOS The kernel – the multitasker The kernel handles tasking It also has resources to pass data between tasks safely, and to synchronize tasking. An RTOS also has resources like communications, a GUI, a file system, and debugging tools.

Polled Loop Wait for something Do something

Polled Loop With Interrupts Interrupt event Wait for interrupt signal Wait for something Handle Interrupt Do something Signal main loop

Enter the RTOS Kernel Interrupt event Handle Interrupt Handle screen Handle TCP/IP Process data Signal RTOS

When Do You Need an RTOS? Multiple independent activities Communications File system GUIs

An Infusion Pump

What About Linux? Memory needs Real-time response Reliability, validation and security Licensing issues Porting Linux is hard!

Multitasking and Tasks void App_TaskADC (void *p_arg) { while (1) { ADC_Read(); OSTimeDly(10); }

Multitasking and Tasks void App_TaskLowFluid (void *p_arg) { code to handle low fluid; OSTaskDel(. . .); }

Task Creation void main (void) { OSInit(); /* Kernel initialization */ OSTaskCreate(...); /* Task creation */ OSTaskCreate(...); OSStart(); /* Start multitasking */ }

TCBs and Stacks Task Control Block Stack Stack pointer Registers Task Priority Rest of stack Task state Other task data

Task States

Scheduling Preemption Context switching Round robin The suspension of one task and start of another Context switching The process of switching from one task to another Round robin The giving of equal time to all same-priority tasks

Round-Robin Scheduling

Priorities

Scheduling Points When a task decides to wait for time to expire When a task sends a message or a signal to another task When an ISR sends a message or a signal to a task When a kernel object is deleted When the priority of a task is changed Other places

I/O Perils Task 1 “Hi There” Terminal “HHio wTdhyere” Task 2 “Howdy”

The Mutex Acquire_mutex; Access_device; Release_mutex;

Semaphores AtoD_Read (uint16 *result) { start ADC conversion wait for semaphore Read A/D return result } ADC_ISR (void) { release semaphore clear interrupt }

Message Queues Rx ISR Message queue Serial Stream Rx Task

Roll Your Own? Consider the cost of buying vs. cost to write Cost to validate Messaging and synchronization Modularity

Rate Monotonic Scheduling (e=execution time, T= execution period) How will you know Ei? Compilers don’t help. Predict and measure. Schedule – highest rate task gets highest priority. May conflict with real time issues If tasks are periodic, and do not share resources or sync with each other, then RMA says: if: E1/T1 + E2/T2 + E3/T3 … <= n(2 1/n - 1) all hard real time deadlines will be met. 23

// Task A – if angle> 90 swap modes void a (void){ int raw; float angle; float scale=2*pi; raw=inport(encoder); angle=(float)raw * scale; if(angle>90)swap_mode; } So here’s an example task. FP FP conversions What’s the execution time? Get a listing, right? 24

0013E7 FF 76 FC PUSH WORD PTR [BP-4] 0013EA 9A 00 00 CALL dicvt Just PART of what was generated Betcha still can’t tell But that’s float; what re ints? 0013DA 9A 00 00 CALL ddload 0013DF 83 C4 04 ADD SP,4 0013E2 9A 00 00 CALL dpush 0013E7 FF 76 FC PUSH WORD PTR [BP-4] 0013EA 9A 00 00 CALL dicvt 0013EF 83 C4 02 ADD SP,2 0013F2 9A 00 00 CALL dpush 0013F7 9A 00 00 CALL drmul 0013FC 83 C4 10 ADD SP,16 0013FF 9A 00 00 CALL dpush 25

k=(l1>l2); 000E8A 8B 56 CA MOV DX,[BP-54] And this is edited for Clarity! Betcha still can’t tell CMSC Change something random and try again? k=(l1>l2); 000E8A 8B 56 CA MOV DX,[BP-54] 000E8D 8B 46 C8 MOV AX,[BP-56] 000E90 3B 56 D6 CMP DX,[BP-42] 000E93 7F 07 JG SHORT L42 000E95 7C 0A JL SHORT L40 000E97 3B 46 D4 CMP AX,[BP-44] 000E9A 76 05 JBE SHORT L40 000E9C B8 01 00 L42 MOV AX,1 000E9F EB 02 JMP L41 000EA1 2B C0 L40 SUB AX,AX 000EA3 89 46 F6 L41 MOV BP-10],AX 000EA6 FF 46 FE INC [BP-2] 26

Talk to the vendors We’re mad as hell and we’re not gonna take it anymore!

Software Selection Reputation/Tech Support Reliability CPU/Language/Tool compatibility Pricing model Source or object? Size and performance Debugging tools Services, drivers Other software components Reputation/Tech Support Reliability

Questions?