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

Similar documents
EECE 276 Embedded Systems

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

CPU Scheduling. CPU Scheduling

Embedded Software Architecture

Comparison between scheduling algorithms in RTLinux and VxWorks

Quality of Service (QoS) on Netgear switches

Chapter 11 I/O Management and Disk Scheduling

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

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

Linux Scheduler. Linux Scheduler

Load balancing Static Load Balancing

From Control Loops to Software

Contributions to Gang Scheduling

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

Lecture 3 Theoretical Foundations of RTOS

4. Fixed-Priority Scheduling

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

Real- Time Scheduling

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances:

Allworx Queuing and Automated Call Distribution Guide (Release x)

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

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

Allworx Queuing and Automated Call Distribution Guide (Release x)

REAL TIME OPERATING SYSTEMS. Lesson-18:

Operating Systems. III. Scheduling.

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

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

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

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

LAB 5: Scheduling Algorithms for Embedded Systems

6.6 Scheduling and Policing Mechanisms

Operating Systems. Virtual Memory

Chapter 1 Computer System Overview

Load Balancing and Termination Detection

WINDOWS CE 5.0 ON AN X86 PLATFORM

Predictable response times in event-driven real-time systems

Chapter 11 I/O Management and Disk Scheduling

Priority Inversion Problem and Deadlock Situations

361 Computer Architecture Lecture 14: Cache Memory

Operating Systems. Lecture 03. February 11, 2013

Operating Systems Lecture #6: Process Management

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

Module 6. Embedded System Software. Version 2 EE IIT, Kharagpur 1

OPERATING SYSTEMS SCHEDULING

Implementing AUTOSAR Scheduling and Resource Management on an Embedded SMT Processor

1. Computer System Structure and Components

OS OBJECTIVE QUESTIONS

Operating System Tutorial

System Architecture Performance Modeling with SystemC

W4118 Operating Systems. Instructor: Junfeng Yang

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

Real-Time Software. Basic Scheduling and Response-Time Analysis. René Rydhof Hansen. 21. september 2010

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

UC CubeSat Main MCU Software Requirements Specification

Linux Process Scheduling Policy

How To Understand And Understand An Operating System In C Programming

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Today. Intro to real-time scheduling Cyclic executives. Scheduling tables Frames Frame size constraints. Non-independent tasks Pros and cons

Cloud Computing. By: Jonathan Delanoy, Mark Delanoy, Katherine Espana, Anthony Esposito, Daniel Farina, Samuel Feher, and Sean Flahive

SYSTEM ecos Embedded Configurable Operating System

Threads Scheduling on Linux Operating Systems

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

Real-time Scheduling of Periodic Tasks (1) Advanced Operating Systems Lecture 2

CPU Scheduling. Core Definitions

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Introduction to Embedded Systems. Software Update Problem

How to design and implement firmware for embedded systems

Processes and Non-Preemptive Scheduling. Otto J. Anshus

The Secrets of RS-485 Half-duplex Communication

Communication Protocol

Operating System: Scheduling

Operating Systems, 6 th ed. Test Bank Chapter 7

The Shortcut Guide To. Availability, Continuity, and Disaster Recovery. Dan Sullivan

Long-term monitoring of apparent latency in PREEMPT RT Linux real-time systems

Binary Heap Algorithms

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

The Real-Time Operating System ucos-ii

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

SoC IP Interfaces and Infrastructure A Hybrid Approach

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

ò Paper reading assigned for next Thursday ò Lab 2 due next Friday ò What is cooperative multitasking? ò What is preemptive multitasking?

Processor Scheduling. Queues Recall OS maintains various queues

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

Linux Driver Devices. Why, When, Which, How?

A Robust Dynamic Load-balancing Scheme for Data Parallel Application on Message Passing Architecture

Process Scheduling. Process Scheduler. Chapter 7. Context Switch. Scheduler. Selection Strategies

ICS Principles of Operating Systems

/ Operating Systems I. Process Scheduling. Warren R. Carithers Rob Duncan

Gaining Competitive Advantage through Reducing Project Lead Times Duncan Patrick, CMS Montera Inc. Jack Warchalowski, CMS Montera Inc.

File Management. Chapter 12

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

VERY IMPORTANT NOTE! - RAID

Nurse Rostering. Jonathan Johannsen CS 537. Scheduling Algorithms

Embedded Systems. 6. Real-Time Operating Systems

Transcription:

Survey of software architectures: function-queue-scheduling architecture and real time OS Reference: Simon chapter 5

Last class: round robin with interrupts and without interrupts

Function-Queue-Scheduling Architecture

Function-Queue-Scheduling Architecture In this architecture, the interrupt routines add function pointers to a queue of function pointers for the main function to call. What makes this architecture worthwhile is that no rule says the main task code has to call the functions in the order that the interrupt occurred. It can call them based on any priority scheme of your choosing. Any task code functions that need quicker response can be executed earlier. All you need is some coding in the routines that queue up the function pointers.

!! Queue of function pointers; void interrupt vhandledevicea (void)!! Take care of I/O Device A!! Put function_a on queue of function pointers void interrupt vhandledeviceb (void)!! Take care of I/O Device B!! Put function_b on queue of function pointers Function Queue Schedule Every time there is an interrupt quickly collect all appropriate data void function_a (void)!! Handle actions required by device A void function_b (void)!! Handle actions required by device B void main(void) while (TRUE) while (!!Queue of function pointers is empty)!! Call first function on queue //end of while (TRUE) //end of void main()... And state that the appropriate data-handling function needs to be executed soon. This is done put putting a function pointer into a queue.

!! Queue of function pointers; void interrupt vhandledevicea (void)!! Take care of I/O Device A!! Put function_a on queue of function pointers void interrupt vhandledeviceb (void)!! Take care of I/O Device B!! Put function_b on queue of function pointers void function_a (void)!! Handle actions required by device A void function_b (void)!! Handle actions required by device B Function Queue Schedule void main(void) while (TRUE) while (!!Queue of function pointers is empty)!! Call first function on queue //end of while (TRUE) //end of void main() The main routine just reads pointers from the queue and calls the functions.

!! Queue of function pointers; void interrupt vhandledevicea (void)!! Take care of I/O Device A!! Put function_a on queue of function pointers void interrupt vhandledeviceb (void)!! Take care of I/O Device B!! Put function_b on queue of function pointers Function Queue Schedule void function_a (void)!! Handle actions required by device A void function_b (void)!! Handle actions required by device B void main(void) while (TRUE) while (!!Queue of function pointers is empty)!! Call first function on queue //end of while (TRUE) //end of void main() If interrupt for device B was triggered first, then this function ought to be executed first.

!! Queue of function pointers; void interrupt vhandledevicea (void)!! Take care of I/O Device A!! Put function_a on queue of function pointers void interrupt vhandledeviceb (void)!! Take care of I/O Device B!! Put function_b on queue of function pointers void function_a (void)!! Handle actions required by device A void function_b (void)!! Handle actions required by device B void main(void) while (TRUE) while (!!Queue of function pointers is empty)!! Call first function on queue //end of while (TRUE) //end of void main() Example While the code is here, Device A interrupts, then Device B interrupts. FunctionA and FunctionB are placed in the queue While code executes functiona, another interrupt occurs, for DeviceA. The code will finish functiona, then will do functionb and finally function A.

!! Queue of function pointers; void interrupt vhandledevicea (void)!! Take care of I/O Device A!! Put function_a on queue of function pointers void interrupt vhandledeviceb (void)!! Take care of I/O Device B!! Put function_b on queue of function pointers void function_a (void)!! Handle actions required by device A void function_b (void)!! Handle actions required by device B void main(void) while (TRUE) while (!!Queue of function pointers is empty)!! Call first function on queue //end of while (TRUE) //end of void main() Priorities You can call functions based on any priority scheme that suits your purposes. Any task code functions that need quicker response can be executed earlier. This looks like a good homework problem :)

!! Queue of function pointers; void interrupt vhandledevicea (void)!! Take care of I/O Device A!! Put function_a on queue of function pointers void interrupt vhandledeviceb (void)!! Take care of I/O Device B!! Put function_b on queue of function pointers void function_a (void)!! Handle actions required by device A void function_b (void)!! Handle actions required by device B void main(void) while (TRUE) while (!!Queue of function pointers is empty)!! Call first function on queue //end of while (TRUE) //end of void main() Big advantage! Since the interrupt routines take very little time... You can have a lot of interrupts happening all at once and you will execute the same function sequentially multiple times!

Issues with function-queue-scheduling architectures In this architecture the worst wait for the highest-priority task code function is the length of the longest of the task code functions. This worst case happens if the longest task code function has just started when the interrupt for the highest-priority device occurs. This is because, the function that is being currently processed needs to finish first and only after this is The done, response the highest for lower-priority function task code in the functions queue can may be get worse. executed. If one of the lower-priority task code functions is quite long, it will affect the response for the higher-priority functions.

Issues with function-queue-scheduling architectures In this architecture the worst wait for the highest-priority task code function is the length of the longest of the task code functions. This worst case happens if the longest task code function has just started when the interrupt for the highest-priority device occurs. The response for lower-priority task code functions may get worse. That s right... Since interrupts now only add functions If to one the of queue the lower-priority (and don t execute task code them functions immediately), is quite long, it will you affect need the to response wait until for the the current higher-priority function that functions. is being executed to end.

Issues with function-queue-scheduling architectures In this architecture the worst wait for the highest-priority task code function is the length of the longest of the task code Yes. If an higher priority interrupt keeps happening, functions. then that particular function will always be the first in This the queue worst to case be happens processed. if the longest task code function has just started when the interrupt for the highest-priority device occurs. The response for lower-priority task code functions may get worse. If one of the lower-priority task code functions is quite long, it will affect the response for the higher-priority functions.

Issues with function-queue-scheduling architectures In this architecture the worst wait for the highest-priority task code function is the length of the longest of the task code functions. Yes. If an lower priority function is (eventually) This worst case happens if the longest task code function has executed, and if its really slow... then the higher just started when the interrupt for the highest-priority device priority functions will have to wait until the slower occurs. function is done. The response for lower-priority task code functions may get worse. If one of the lower-priority task code functions is quite long, it will affect the response for the higher-priority functions.

Queues vs round robin Of course there are some trade-offs. In queues higher priority functions have better response, however lower priority functions will suffer. In round robin architectures, all functions will eventually be processed. With queues, there is an off change that all low priority functions will never be processed, if high priority interrupts keep happening.

Real-time operating system architecture

Real time architectures void interrupt vhandledevicea (void)!! Take care of I/O Device A!! Set signal X void interrupt vhandledeviceb (void)!! Take care of I/O Device B!! Set signal Y void Task1 (void) while (TRUE)!! Wait for Signal X!! Handle data to/from I/O Device A void Task2 (void) while (TRUE)!! Wait for Signal Y!! Handle data to/from I/O Device B Today is just a brief introduction to real time architectures. We will be spending most of the next couple of weeks discussing this type of architecture in detail. Interrupt routines take care of the urgent operations. They then signal that there is work to be done in the task code.

Basics of RTOS architectures void interrupt vhandledevicea (void)!! Take care of I/O Device A!! Set signal X void interrupt vhandledeviceb (void)!! Take care of I/O Device B!! Set signal Y void Task1 (void) while (TRUE)!! Wait for Signal X!! Handle data to/from I/O Device A void Task2 (void) while (TRUE)!! Wait for Signal Y!! Handle data to/from I/O Device B The necessary signaling between the interrupt routines and the task code is handled by the real time operating system (RTOS). The RTOS code is not outlined in the code. We do NOT need shared variables for this. No loop in the code decides what to do next. The RTOS also decides what tasks run next.

Basics of RTOS architectures The RTOS can suspend one task subroutine in the middle of processing in order to run another. If Task1 is the highest priority task, then when the vhandledevicea interrupt occurs, this task will be done immediately. The worst-case wait scenario for Task1 is then zero (plus the interrupt handling times).

Side effect #1 of RTOS architectures: stable response The system response is very stable, even when we change the code. In round robin architectures and queues, the response time depends on the various task code subroutines (even the lowest priority ones). In RTOS architectures, changing the low priority functions, does not affect high-priority functions.

Side effect #2 of RTOS architectures: widely available for purchase RTOS are so important and useful that there are several companies that specialize in selling the operating system for each architecture. ChibiOS/RT, FreeRTOS, MicroC/ OS, Salvo Some are even compatible with the Atmel ATmega chips! For example, visit the FreeRTOS website.

Disadvantages of RTOS architectures void interrupt vhandledevicea (void)!! Take care of I/O Device A!! Set signal X void interrupt vhandledeviceb (void)!! Take care of I/O Device B!! Set signal Y void Task1 (void) while (TRUE)!! Wait for Signal X!! Handle data to/from I/O Device A void Task2 (void) while (TRUE)!! Wait for Signal Y!! Handle data to/from I/O Device B The RTOS itself uses a certain amount of processing time. The RTOS requires storage space... and in embedded systems space is very sparse.

Summary of software architectures

Which architecture should you use? Select the simplest architecture that will meet your response requirements. If your system has response requirements that might necessitate using a real-time operating system, then use a real-time operating system. If it makes sense, you can even create hybrids architectures (e.g. round-robin with scheduling working side by side a RTOS).

Priorities available Worst time response for task code Stability of response when code changes Simplicity Round-robin None. Sum of all task code. Poor. Very simple. Round-robin with interrupts Interrupt routines in priority order, then all task code with the same priority. Total of execution time for all task code (plus execution time for interrupt routines). Good for interrupt routines. Poor for task code. Must deal with shared data problems between interrupt routines and task code. Function queuescheduling Interrupt routines in priority order, then all task code in priority order. Execution time for the longest function (plus execution time for interrupt routines). Relatively good. Must deal with shared data and must write function queue code. Real time operating system Interrupt routines in priority order, then all task code in priority order. Zero (plus execution time for interrupt routines). Very good. Most complex (although much of the complexity is in the operating system itself).