EECE 276 Embedded Systems

Similar documents
Survey of software architectures: function-queue-scheduling architecture and real time OS

SYSTEM ecos Embedded Configurable Operating System

Data Structures and Algorithms Stacks and Queues

Linux Process Scheduling Policy

QUEUES. Primitive Queue operations. enqueue (q, x): inserts item x at the rear of the queue q

I/O Management. General Computer Architecture. Goals for I/O. Levels of I/O. Naming. I/O Management. COMP755 Advanced Operating Systems 1

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

PROGRAMMING CONCEPTS AND EMBEDDED PROGRAMMING IN C, C++ and JAVA: Lesson-4: Data Structures: Stacks

Processor Scheduling. Queues Recall OS maintains various queues

Comparison between scheduling algorithms in RTLinux and VxWorks

CS414 SP 2007 Assignment 1

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

CPU Scheduling. CPU Scheduling

Operating Systems Lecture #6: Process Management

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

Performance Comparison of RTOS

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

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

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

CPU Scheduling 101. The CPU scheduler makes a sequence of moves that determines the interleaving of threads.

Operating Systems. III. Scheduling.

Embedded Systems. 6. Real-Time Operating Systems

Chapter 2: OS Overview

REDUCING TIME: SCHEDULING JOB. Nisha Yadav, Nikita Chhillar, Neha jaiswal

Embedded Software Architecture

REAL TIME OPERATING SYSTEMS. Lesson-10:

Predictable response times in event-driven real-time systems

W4118 Operating Systems. Instructor: Junfeng Yang

Introduction. Scheduling. Types of scheduling. The basics

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

CPU Scheduling. Core Definitions

Chapter 5 Process Scheduling

Operating System: Scheduling

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

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

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

Operating Systems Concepts: Chapter 7: Scheduling Strategies

EECS 750: Advanced Operating Systems. 01/28 /2015 Heechul Yun

Chapter 11 I/O Management and Disk Scheduling

Chapter 13 Embedded Operating Systems

Lecture 6: Interrupts. CSC 469H1F Fall 2006 Angela Demke Brown

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

Designing a Home Alarm using the UML. And implementing it using C++ and VxWorks

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

DATA STRUCTURE - QUEUE

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

Threads Scheduling on Linux Operating Systems

Real-time Operating Systems. VO Embedded Systems Engineering Armin Wasicek

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

Chapter 11 I/O Management and Disk Scheduling

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

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

OPERATING SYSTEMS SCHEDULING

A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

3. Scheduling issues. Common approaches /1. Common approaches /2. Common approaches / /13 UniPD / T. Vardanega 23/01/2013. Real-Time Systems 1

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

How to design and implement firmware for embedded systems

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

Real- Time Scheduling

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

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

Intel DPDK Boosts Server Appliance Performance White Paper

Implementing AUTOSAR Scheduling and Resource Management on an Embedded SMT Processor

What is an RTOS? Introduction to Real-Time Operating Systems. So what is an RTOS?(contd)

Introduction. Application Performance in the QLinux Multimedia Operating System. Solution: QLinux. Introduction. Outline. QLinux Design Principles

OS OBJECTIVE QUESTIONS

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

Class Overview. CSE 326: Data Structures. Goals. Goals. Data Structures. Goals. Introduction

CPU Scheduling. Multitasking operating systems come in two flavours: cooperative multitasking and preemptive multitasking.

Queues and Stacks. Atul Prakash Downey: Chapter 15 and 16

Devices and Device Controllers

Task Scheduling for Multicore Embedded Devices

Threads & Tasks: Executor Framework

First-class User Level Threads

CPU Scheduling. CSC 256/456 - Operating Systems Fall TA: Mohammad Hedayati

From Control Loops to Software

Chapter 1 Computer System Overview

Real-Time Component Software. slide credits: H. Kopetz, P. Puschner

Processes and Non-Preemptive Scheduling. Otto J. Anshus

ò Scheduling overview, key trade-offs, etc. ò O(1) scheduler older Linux scheduler ò Today: Completely Fair Scheduler (CFS) new hotness

Hard Real-Time Linux

Networking Operating Systems (CO32010)

Java Environment for Parallel Realtime Development Platform Independent Software Development for Multicore Systems

Enhancing the Monitoring of Real-Time Performance in Linux

Asymmetric Scheduling and Load Balancing for Real-Time on Linux SMP

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

ICS Principles of Operating Systems

Enhancing Hypervisor and Cloud Solutions Using Embedded Linux Iisko Lappalainen MontaVista

Linux Scheduler. Linux Scheduler

Chapter 6 Concurrent Programming

Transcription:

EECE 276 Embedded Systems Embedded SW Architectures Round-robin Function-queue scheduling EECE 276 Embedded Systems Embedded Software Architectures 1

Software Architecture How to do things how to arrange code for an embedded system application. Four variants: 1. Round-robin 2. Round-robin with interrupts 3. Function-queue-scheduling 4. Real-time Operating System EECE 276 Embedded Systems Embedded Software Architectures 2

Round-robin: Poll and Serve void main() { while(true) { if(// I/O Device #1 needs service) { // Service I/O #1 if(// I/O Device #2 needs service) { // Service I/O #2 if(// I/O Device #n needs service) { // Service I/O #n EECE 276 Embedded Systems Embedded Software Architectures 3

Round-robin: Poll and Serve Pro: Very simple, straightforward, no interrupts Cons: 1. If a device needs faster service than the cycletime, it may not work. 2. If there is a lengthy processing, the system may not react fast enough. 3. Very fragile hard to extend, reprogram, change. 4. No interrupts! EECE 276 Embedded Systems Embedded Software Architectures 4

Round-robin with interrupts (1) bool fdev1 = FALSE, fdev2 = FALSE, fdevn = FALSE; void interrupt vhandledev1() { // Handle Dev 1 fdev1 = TRUE; void interrupt vhandledevn() { // Handle Dev n fdevn = TRUE; For every device: ISR handles I/O termination and sets flag. EECE 276 Embedded Systems Embedded Software Architectures 5

Round-robin with interrupts (2) void main() { while (TRUE) { if(fdev1) { fdev1 = FALSE; // Handle data from Dev 1 if(fdevn) { fdevn = FALSE; // Handle data from Dev n For every device: if device needs attention, main handles data and clears flag. EECE 276 Embedded Systems Embedded Software Architectures 6

Round-robin with interrupts ISRs: handlers for I/O, main(): task code ISR-s ensure fast initial reactions to devices Priorities: vhandledev1 > vhandledev2 > vhandledevn (per IT priority) Problem: All tasks (non-isr codes) are handled with the same priority Solution: Move task code into ISR May slow down system (longer ISR!) Change the order of flag-polling in main() Priority through polling order WCRT: total exec time for all task codes + all ISR-s EECE 276 Embedded Systems Embedded Software Architectures 7

Function-Queue-Scheduling Queue data structure: Queue of elements Queue enqueue(queue,elem); Elem dequeue(queue); First-in-first-out (FIFO) order Variant: Priority Queue List of queues ordered according to priority EECE 276 Embedded Systems Embedded Software Architectures 8

Function-Queue-Scheduling (1) void interrupt vhandledev1() { // Handle Dev 1 enqueue(q,fp1); void interrupt vhandledevn() { // Handle Dev n enqueue(q,fpn); ISR: Take care of device and enqueue corresponding function pointer. EECE 276 Embedded Systems Embedded Software Architectures 9

Function-Queue-Scheduling (2) void fp1() { Task functions for each task. // Task code for Dev 1 void fp2() { // Task code for Dev Q: A shared Queue void main() { while(true) { while(//queue of function pointers is not empty) { fp = dequeue(q); // call fp Dequeue next function pointer and call function. EECE 276 Embedded Systems Embedded Software Architectures 10

Function-Queue-Scheduling WCRT if priority queue is used: Longest task code + exec time of ISRs Tradeoff: Response time for low-priority task code may get worse! Starvation because of higher-priority interrupts EECE 276 Embedded Systems Embedded Software Architectures 11

Real-Time OS (1) void interrupt vhandledev1() { // Handle Dev 1 // Send signal #1 void interrupt vhandledevn() { // Handle Dev n // Send signal #n ISR: Take care of device and send a unique signal. EECE 276 Embedded Systems Embedded Software Architectures 12

Real-time OS (2) void task1() { // Wait for signal #1 // Task code for Dev 1 void taskn() { // Wait for signal #n // Task code for Dev void main() { // Start task1 // Start taskn Task: A concurrent activity, with its own thread of control/stack ( context ) EECE 276 Embedded Systems Embedded Software Architectures 13

Real-Time OS Architecture RTOS provides:» Task creation and processor scheduling services» Processor is time-sliced across tasks» Signaling services (send() and wait()) ISR1 TASK3 TASK2 TASK1 Arrows indicate context (task) switching points Time EECE 276 Embedded Systems Embedded Software Architectures 14

Comparison Priorities WCRT Stability at code changes Complexity Round-robin None Sum of all task code Poor Very simple Round-robin with interrupts ISR in priority order, tasks same priority Total of all task code + all ISRs Poor if task code is changed Shared data problem (ISRs and task code) Function Queue Scheduling ISRs and task code in priority order Execution time for the longest task code + ISRs Queue mgmt is critical Shared data problem and function queue code RTOS ISRs and task code in priority order 0 + ISR execution times Very good High (needs kernel) EECE 276 Embedded Systems Embedded Software Architectures 15