An Embedded Software Primer

Slides:



Advertisements
Similar presentations
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Advertisements

CSE 522 Real-Time Scheduling (4)
Engineering Open House Need students to demo their players on –Friday 3-4 –Saturday 10-2.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Embedded Systems Software Architectures C.-Z. Yang Sept.-Dec
Embedded Systems Basic Design Using a Real- Time Operating System C.-Z. Yang Sept.-Dec
Embedded Systems Interrupts C.-Z. Yang Sept.-Dec
IN2305-II Embedded Programming Lecture 5: Survey of SW Architectures.
Advanced Embedded Systems Design Pre-emptive scheduler BAE 5030 Fall 2004 Roshani Jayasekara Biosystems and Agricultural Engineering Oklahoma State University.
Chapter 6: CPU Scheduling
OPERATING SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
More Scheduling cs550 Operating Systems David Monismith.
CHP-4 QUEUE.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
Chapter 8 I/O. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8-2 I/O: Connecting to Outside World So far,
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
6.0 INTRODUCTION TO REAL-TIME OPERATING SYSTEMS (RTOS) 6.0 Introduction A more complex software architecture is needed to handle multiple tasks, coordination,
CS333 Intro to Operating Systems Jonathan Walpole.
1 Run-to-Completion Non-Preemptive Scheduler. 2 In These Notes... What is Scheduling? What is non-preemptive scheduling? Examples Run to completion (cooperative)
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Process Scheduling. Scheduling Strategies Scheduling strategies can broadly fall into two categories  Co-operative scheduling is where the currently.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
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.
Chapter 8 I/O.
REAL-TIME OPERATING SYSTEMS
OPERATING SYSTEMS CS 3502 Fall 2017
Resource Management IB Computer Science.
Chapter 2 Memory and process management
EMERALDS Landon Cox March 22, 2017.
CS501 Advanced Computer Architecture
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Topics Covered What is Real Time Operating System (RTOS)
6.0 INTRODUCTION TO REAL-TIME OPERATING SYSTEMS (RTOS/RTK)
Safe Queue? … while (next(head) == tail); // block if full
OPERATING SYSTEMS CS3502 Fall 2017
Networks and Operating Systems: Exercise Session 2
Computer Architecture
An Embedded Software Primer
An Embedded Software Primer
Lecture 4 Schedulability and Tasks
Chapter 8 I/O.
Real-time Software Design
Chapter 6: CPU Scheduling
Semaphores -Gajendra Singh.
An Embedded Software Primer
Chapter 8 I/O.
ICS 143 Principles of Operating Systems
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Computer System Overview
Operating System Concepts
Chapter 2: The Linux System Part 3
TDC 311 Process Scheduling.
Chapter 8 I/O.
Last Week Introduced operating systems Discussed the Kernel
CPU SCHEDULING.
EE 472 – Embedded Systems Dr. Shwetak Patel.
CSCI1600: Embedded and Real Time Software
Embedded System Development Lecture 7 2/21/2007
Chapter 8 I/O.
An Embedded Software Primer
Chapter 10 Multiprocessor and Real-Time Scheduling
Embedded System Development Lecture 12 4/4/2007
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:

An Embedded Software Primer David E. Simon

Chapter 5: Survey of Software Architectures Round-Robin Round-Robin with Interrupts Function-Queue-Scheduling Architecture Real-Time Operating System Architecture Selecting an Architecture 3/11/2006

Round-Robin The following code (Fig. 5.1 Simon) illustrates a round-robin where the code checks each I/O device in turn and services them as needed. 3/11/2006

Round-Robin (contd.) This is the simplest architecture devoid of interrupts or shared-data concerns. A digital multimeter illustrates this. A pseudo-code written for it would consist of a switch-case loop that performs functions based on the position of the rotary switch. However several problems offset its simplicity advantage:- If a device has a lower response time this architecture won’t work. e.g. if in Fig. 5.1 device Z has a deadline of 15 ms and A and B take 10 ms each. If any one of the cases for the multimeter could at the worst take 5 seconds, the system would have a max. response time of 5 seconds, which would make it less appealing. Architecture is not robust. Addition of a single device might cause all deadlines to be missed. 3/11/2006

Round-Robin with Interrupts Fig. 5.4 shows a round-robin with interrupts. 3/11/2006

Round-Robin with Interrupts (contd.) ISRs called by each device set flags. These are in turn polled by the main program that then does the required follow-up processing. ISRs can be assigned priorities as per the requirements giving better response especially for devices with hard deadlines. The disadvantage is the complexity of having to work with the shared-data variables. Examples: A Simple Bridge A communication bridge is a simple example that passes data between 2 ports. Assume the bridge encrypts data at one port and decrypts it at the other (Fig. 5.6). 3/11/2006

Round-Robin with Interrupts (contd.) 3/11/2006

Round-Robin with Interrupts (contd.) A character received at one of the bridge links causes an interrupt that must be serviced before the next character arrives. The link will be busy while sending a character after which it will interrupt the microprocessor to indicate it is ready for the next character. Routines read and write characters to queues and check whether the queues is empty or not. Encryption and decryption is handled by routines. Fig. 5.7 shows the code. Transmitting and receiving characters on links A and B are handled by separate ISRs. vEncrypt and vDecrypt in main read the data queues and pass the processed data to qDataToLinkA and qDataToLinkB. fLinkAReadyToSend and fLinkBReadyToSend track whether I/O is ready to send characters. Note that shared-data sections are made atomic. As reading and writing is done in ISRs, these have higher priority than the encryption or decryption, so a sudden character burst will not cause system overruns. 3/11/2006

Round-Robin with Interrupts (contd.) 3/11/2006

Round-Robin with Interrupts (contd.) Characteristics of the Round-Robin with Interrupts The main shortcoming of this architecture is that all the task code executes with the same priority. If devices A,B and C in fig. 5.4 take 200 ms, C will have to wait 400 ms. This can be avoided by moving C’s task code to the ISR at the expense of increased interrupt latency of lower priority devices. Another solution is to check C’s flag more often like A,C,B,C,D,C....... The worst-case response for a device task-code occurs when the its interrupt occurs immediately after main passes its task code. Examples where this architecture does not work are :- A laser printer. Calculating locations for the black dots is time consuming so only ISRs will get good response. If task codes are moved into ISRs low priority interrupts will not be serviced fast enough. Underground tank monitoring system. The code that calculates the gasoline amount hogs the processor. 3/11/2006

Function-Queue-Scheduling Architecture Fig. 5.8 shows an implementation of this architecture. 3/11/2006

Function-Queue-Scheduling Architecture (contd.) The ISRs add function pointers to a queue for main to call. Main can call the functions based on a preset priority providing better response times for higher priority tasks The worst-case response (WCR) for the highest priority task is equal to the longest task code function assuming that it started just before the ISR put the function pointer for the highest priority task in the queue. This is much better than the round-robin-with-interrupts which has a WCR equal to the sum of all the task codes for the other devices. A disadvantage of the architecture apart from the complexity involved is that a high priority task might hog the processor, and a lower priority task might never get to execute. 3/11/2006

Real-Time Operating System Architecture Fig. 5.9 shows the operation. 3/11/2006

Real-Time Operating System Architecture (contd.) Again ISRs handle important sections. Some differences from previous architectures are :- The real-time operating system (RTOS) handles communications between ISRs and task codes. The RTOS will decide which task code to run based on urgency (priority) RTOS can suspend a task to run another (usually higher priority) one. If an ISR sets a flag for a higher priority task the RTOS runs the task immediately on return even if it is in the middle of another lower priority one. Hence the worst-case response is zero. Response is basically independent of task code length unlike previous architectures. Changes to code lengths of low priority tasks don’t affect higher priority tasks. One disadvantage might be the added RTOS processing time. 3/11/2006

Selecting an Architecture Select the simplest architecture meeting response requirements. RTOSs should be used where response requirements demand them. Hybrid architectures can be used if required. e.g. you can use an RTOS with a low-priority task polling the relatively slower hardware. 3/11/2006