Interrupt Management In Real-time Systems

Slides:



Advertisements
Similar presentations
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
Advertisements

Lecture 11: Operating System Services. What is an Operating System? An operating system is an event driven program which acts as an interface between.
CSE 522 Real-Time Scheduling (4)
Operating Systems Process Scheduling (Ch 3.2, )
Sporadic Server Scheduling in Linux Theory vs. Practice Mark Stanovich Theodore Baker Andy Wang.
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
April 16, 2009 Center for Hybrid and Embedded Software Systems PtidyOS: An Operating System based on the PTIDES Programming.
Scheduling in Batch Systems
Chapter 6: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 6: CPU Scheduling Basic.
1 Soft Timers: Efficient Microsecond Software Timer Support For Network Processing Mohit Aron and Peter Druschel Rice University Presented By Jonathan.
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
1 Chapter 13 Embedded Systems Embedded Systems Characteristics of Embedded Operating Systems.
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Scheduler What is the job of.
OPERATING SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
Lecture 2 Process Concepts, Performance Measures and Evaluation Techniques.
Round Robin Scheduling A preemptive scheduling designed for Time Sharing Systems The Ready Queue is treated as a circular queue A small execution.
Scheduling policies for real- time embedded systems.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Operating Systems Process Management.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Mutual Exclusion.
I/O Interfacing A lot of handshaking is required between the CPU and most I/O devices. All I/O devices operate asynchronously with respect to the CPU.
Scheduling Lecture 6. What is Scheduling? An O/S often has many pending tasks. –Threads, async callbacks, device input. The order may matter. –Policy,
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems with Multi-programming Chapter 4.
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Real-Time systems By Dr. Amin Danial Asham.
1 Real-Time Scheduling. 2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Performance Performance is about time and the software system’s ability to meet timing requirements.
Lecture Topics: 11/15 CPU scheduling: –Scheduling goals and algorithms.
Lecture 12 Page 1 CS 111 Online Using Devices and Their Drivers Practical use issues Achieving good performance in driver use.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
Networked Embedded Systems Pengyu Zhang & Sachin Katti EE107 Spring 2016 Lecture 4 Timers and Interrupts.
Lecture 4 Page 1 CS 111 Summer 2013 Scheduling CS 111 Operating Systems Peter Reiher.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU Scheduling CS Introduction to Operating Systems.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
Scheduling.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Preventing Interrupt Overload Presented by Jiyong Park Seoul National University, Korea John Regehr, Usit Duogsaa, School of Computing, University.
Advanced OS Concepts (For OCR)
OPERATING SYSTEMS CS3502 Fall 2017
Wayne Wolf Dept. of EE Princeton University
Chapter 2 Scheduling.
Chapter 2.2 : Process Scheduling
Real-time Software Design
Process Scheduling B.Ramamurthy 9/16/2018.
Chapter 6: CPU Scheduling
Process management Information maintained by OS for process management
Chapter 6: CPU Scheduling
Lecture 21: Introduction to Process Scheduling
Operating System Concepts
Processor Fundamentals
CPU SCHEDULING.
Chapter 6: CPU Scheduling
Wireless Embedded Systems
Lecture 21: Introduction to Process Scheduling
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
Presentation transcript:

Interrupt Management In Real-time Systems This presentation is based on J. Regehr's work titled “Preventing Interrupt Overload”. Saud Wasly

Lecture Agenda Introduction What is Interrupt Overload Why it is a problem How to avoid it Introduce some solutions and their results Discussion Extra topic

Introduction Interrupt driven systems are much more power efficient than polling based systems. In normal cases Interrupts save CPU time, allowing it to do more works while waiting for interrupt signals. Better Utilization Interrupts preempt the current execution flow, disrupting CPU scheduling. Interrupts introduce some overhead

Consume much more power Polling Polling is 100% under control of CPU scheduler

Interrupts VS Polling “Polling is like picking up your phone every few seconds to see if you have a call. Interrupts are like waiting for the phone to ring.” Interrupts win if processor has other work to do and event response time is not critical Polling can be better if processor has to respond to an event as soon as possible

What is Interrupt Overload? Excessive arrival of interrupts can delay the execution of the current running task. When Interrupts arrival rate it to high livelock can happen Livelock: A situation in which some critical stage of a task is unable to finish because its clients perpetually create more work for it to do after they have been serviced but before it can clear its queue. Differs from deadlock in that the process is not blocked or waiting for anything, but has a virtually infinite amount of work to do and can never catch up.

High Interrupt load may not cause an overload. Why ? Interrupt Overload High Interrupt load may not cause an overload. Why ? Unexpected high interrupt load can cause the overload Example: loose wire, broken equipment, blabbing idiot, etc..

Interrupt Overload

Why is it a problem? Interrupts are implicitly given higher priority than processing done in other contexts such as threads. In real-time systems tasks have to run in predicted schedule to meet their deadlines Unexpected events can shift the schedule of the tasks to end up with unpredictable system

How to avoid it? First of all, at design time, every interrupt source (e.g. IO devices) has to respect the system limits (capacity of handling interrupts). Application Dependant The system suppose to be able to handle all interrupts in predictable manner according to design rules, since no interrupt source violates the rules. However, Interrupt sources may violate the rules !!!

How to avoid it? Is to prevent the CPU from handling interrupt when developer-specified conditions are met.

Motivations Embedded systems are often highly resource-limited. Embedded systems tend to have strict timing (e.g. sensor/actuator feedback loops). Embedded systems are extremely cost sensitive. (use cheap peripherals )

The Proposed Interrupt Scheduler Average processor load must be proportional to the interrupt arrival rate during under-load. Average processor load must be bounded by a constant during overload. It must be possible to quantify the worst-case delays incurred by low-priority interrupts and non-interrupt work to give them performance guarantees. The schedulers should be dynamically parameterizable in order to permit systems to flexibly choose appropriate levels of protection from interrupt overload. Overhead must be reasonable.

Solution #1 – Strict Software Scheduler It enforces a minimum interarrival time between interrupts. The algorithm is simple: Disable the interrupt, set a timer, upon expiry enable the interrupt. The overhead: doubling the number of interrupts handled.

Solution #1 – Bursty Software Scheduler It enforces a minimum inter-arrival time between bursts. The algorithm: needs maximum burst size, maximum arrival rate; use a counter to count interrupts and, after a burst completed, force the delay with the timer. What if the burst size if variable ? The overhead: Less than Strict Scheduler Burst Size and burst arrival rate trade of

Solution #3 – Hardware Scheduler A hardware-based implementation can simply filter undesirable signals out of the wire. The overhead: No CPU overhead The algorithm: Fixed-rate decrementing Counter, pass interrupt signal to CPU when counter is zero, reset the counter. Only one signal get propagated in one counting period.

Solution #3 – Hardware Scheduler

Solution #3 – Hardware Scheduler VHDL Implementation saves more space than external microcontroller

Scheduling multiple interrupt sources Strict scheduler: replicate the hardware or software for each interrupt source The Bursty scheduler, on the other hand, presents interesting opportunities for optimization by using a single periodic timer to clear the counters for multiple interrupt sources. Timer rate can be set to LCM of burst arrival rate with some rounding up. More optimization: We can round up the maximum allowed rates to some multiples of a large number, allowing a single slow timer to service them all and still maintain reasonable protection.

Some Issues What will happen when programmers need to disable one of the interrupt sources? There must be two enable bits for a source. one for scheduler and the other for programmer What are the Implications of dropping interrupts

The Experiment Setup The experiment has conducted with Mica motes based on ATmega103L, 4MHz, 4KB of SRAM Interrupt frequencies from 0.26kHZ to 16kHZ Interrupt schedulers enforce a maximum arrival rate of 4kHz Chosen measure is the processor load.

The Platform Constants

Calculating WCET 𝐶𝑡𝑖𝑚𝑒𝑟 = 𝑡𝑒𝑥𝑝𝑖𝑟𝑒 + 𝑡𝑝𝑜𝑙𝑙 + 𝑡𝑤𝑜𝑟𝑘 𝑇 = 𝑡𝑎𝑟𝑟𝑖𝑣𝑎𝑙 Polling 𝐶𝑖𝑛𝑡𝑒𝑟𝑟𝑢𝑝𝑡 = 𝑡𝑖𝑛𝑖𝑡 + 𝑡𝑓𝑙𝑖𝑝 + 𝑡𝑠𝑒𝑡𝑢𝑝+𝑡𝑤𝑜𝑟𝑘 𝐶𝑡𝑖𝑚𝑒𝑟 = 𝑡𝑒𝑥𝑝𝑖𝑟𝑒 + 𝑡𝑓𝑙𝑖𝑝 𝑇 = 𝑡𝑎𝑟𝑟𝑖𝑣𝑎𝑙 Strict 𝐶𝑖𝑛𝑡𝑒𝑟𝑟𝑢𝑝𝑡 =𝑁 𝑡𝑖𝑛𝑖𝑡+𝑡𝑤𝑜𝑟𝑘+𝑡𝑐𝑜𝑢𝑛𝑡 +𝑡𝑓𝑙𝑖𝑝 𝐶𝑡𝑖𝑚𝑒𝑟 = 𝑡𝑒𝑥𝑝𝑖𝑟𝑒 + 𝑡𝑐𝑙𝑒𝑎𝑟 +𝑡𝑓𝑙𝑖𝑝 𝑇 = 𝑡 𝑎𝑟𝑟𝑖𝑣𝑎𝑙 Bursty 𝐶𝑖𝑛𝑡𝑒𝑟𝑟𝑢𝑝𝑡 = 𝑡𝑖𝑛𝑖𝑡+ 𝑡𝑤𝑜𝑟𝑘 𝑇 = 𝑡 𝑎𝑟𝑟𝑖𝑣𝑎𝑙 Hardware

Experiment-1 an empty ISR

Experiment-2 a 250 computation cycle ISR

Experiment-3 two interrupt sources

Case Study The Ethernut board version 1.3f 10 Mbps Ethernet interface and an AVR ATmega128 processor running at 16 MHz The Nut/OS with TCP/IP Stack to build a Web Server. Start with few hundreds PPS Generate Sound at 250 Hz at thread level with maximum priority. increasing packet loads up to 1500, 1600 PPS, Sound stopped. Appling bursty scheduler at Tarrival = 25 ms and Burst size = 15 (typical small web transaction generates 14 interrupts) Sound continue to play even with 10,000 PPS

Small Addition In case of a system with multi-interrupt sources. For debugging even in production Environment, it will be helpful to tag any faulty source of interrupt At ISR, if the source exceeds the limit (e.g. burst size) tag it as faulty. Then make use of this information, such as repair the wire

Demand-Based Schedulability Analysis Demand-based schedulability analysis views the schedulability analysis problem in terms of supply and demand. If demand in any time interval cannot exceed the computational capacity then the system is schedulable Aperiodic device-driver tasks present a special challenge for demand-based schedulability ??

Demand-Based Schedulability Analysis Device Drivers generate variable workload for the system Usually, they run on higher priority than the other working threads How to bound their workload to the benefit of the other task without compromising the quality of I/O service

Demand-Based Schedulability Analysis Can we know the maximum interference of a device driver to the running task? The Task knows how long it has been preempted

Model WC Interference by Hyperbolic Load-Bound Function Empirical Performance data Use the Load-Bound function in demand-based schedulability analysis.

Questions Are Welcomed Thank you Questions Are Welcomed

References In proceedings(regehr2005preventing) Regehr, J. & Duongsaa, U. Preventing interrupt overload ACM SIGPLAN Notices 2005, Vol. 40(7), pp. 50-58 http://www.cs.toronto.edu/~demke/469F.06/Lectures/Lecture6.pdf In proceedings(lewandowski2007modeling) Lewandowski, M., Stanovich, M., Baker, T., Gopalan, K. & Wang, A. Modeling device driver effects in real-time schedulability analysis: Study of a network driver Real Time and Embedded Technology and Applications Symposium, 2007. RTAS'07. 13th IEEE 2007, pp. 57-68