Real Time System with MVL. © 2007 MontaVista Confidential | Overview of MontaVista Agenda Why Linux Real Time? Linux Kernel Scheduler Linux RT technology.

Slides:



Advertisements
Similar presentations
Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
Advertisements

Introduction to Embedded Systems Resource Management - III Lecture 19.
Copyright © 2000, Daniel W. Lewis. All Rights Reserved. CHAPTER 8 SCHEDULING.
Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Operating Systems Process Scheduling (Ch 3.2, )
Sogang University Advanced Operating Systems (Process Scheduling - Linux) Advanced Operating Systems (Process Scheduling - Linux) Sang Gue Oh, Ph.D. .
Model for Supporting High Integrity and Fault Tolerance Brian Dobbing, Aonix Europe Ltd Chief Technical Consultant.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
1 Multiprocessor and Real-Time Scheduling Chapter 10.
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Supporting Time-sensitive Application on a Commodity OS Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Presented by Wen Sun Some Slides.
Supporting Time-Sensitive Applications on a Commodity OS by Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Jimi Watson.
Supporting Time-sensitive Application on a Commodity OS By Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Presenter: Shuping Tien.
1 Traditional OSes with Soft Real- Time Scheduling Module 3.3 For a good summary, visit:
5: CPU-Scheduling1 Jerry Breecher OPERATING SYSTEMS SCHEDULING.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
Operating Systems Process Scheduling (Ch 4.2, )
Spring 2002Real-Time Systems (Shin) Rate Monotonic Analysis Assumptions – A1. No nonpreemptible parts in a task, and negligible preemption cost –
Comparative Operating Systems Fall 2001 An Examination of Embedded Linux as a Real Time Operating System Mark Mahoney.
Introduction to Embedded Systems
 Scheduling  Linux Scheduling  Linux Scheduling Policy  Classification Of Processes In Linux  Linux Scheduling Classes  Process States In Linux.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 5 Operating Systems.
OPERATING SYSTEMS CPU SCHEDULING.  Introduction to CPU scheduling Introduction to CPU scheduling  Dispatcher Dispatcher  Terms used in CPU scheduling.
1 Previous lecture review n Out of basic scheduling techniques none is a clear winner: u FCFS - simple but unfair u RR - more overhead than FCFS may not.
Linux and Real Time Real-time systems are characterized by deadlines. When a missed deadline results in inconvenience or a diminished customer experience,
SYNCHRONIZATION Module-4. scheduling Scheduling is an operating system mechanism that arbitrate CPU resources between running tasks. Different scheduling.
Outline for Today Objectives: Linux scheduler Lottery scheduling
Scheduling Basic scheduling policies, for OS schedulers (threads, tasks, processes) or thread library schedulers Review of Context Switching overheads.
Scheduling Strategies Operating Systems Spring 2004 Class #10.
CPU Scheduling Presentation by Colin McCarthy. Runqueues Foundation of Linux scheduler algorithm Keeps track of all runnable tasks assigned to CPU One.
Scheduling Lecture 6. What is Scheduling? An O/S often has many pending tasks. –Threads, async callbacks, device input. The order may matter. –Policy,
Fall 2013 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.
CSE 451: Operating Systems Section 5 Midterm review.
Kernel Locking Techniques by Robert Love presented by Scott Price.
ECE 720T5 Fall 2012 Cyber-Physical Systems Rodolfo Pellizzoni.
LINUX SCHEDULING Evolution in the 2.6 Kernel Kevin Lambert Maulik Mistry Cesar Davila Jeremy Taylor.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Scheduling II: priority scheduling.
Traditional UNIX Scheduling Scheduling algorithm objectives Provide good response time for interactive users Ensure that low-priority background jobs do.
Embedded Systems OS. Reference Materials The Concise Handbook of Real- Time Systems TimeSys Corporation.
ITFN 2601 Introduction to Operating Systems Lecture 4 Scheduling.
1 Real-Time Scheduling. 2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling.
Lecture 12 Page 1 CS 111 Online Using Devices and Their Drivers Practical use issues Achieving good performance in driver use.
CS333 Intro to Operating Systems Jonathan Walpole.
For a good summary, visit:
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 3.
Linux Process Management. Linux Implementation of Threads Threads enable concurrent programming / true parallelism Linux implementation of threads.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
Interrupt Handler Migration and Direct Interrupt Scheduling for Rapid Scheduling of Interrupt-driven Tasks Reviewer: Kim, Hyukjoong ESLab.
Operating Systems Unit 5: – Processor scheduling – Java – Linux – Windows XP Operating Systems.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
© 2013 MontaVista Software, LLC. MontaVista Confidential and Proprietary. CGE7 Core Isolation Nawneet Anand.
Real-Time Operating Systems RTOS For Embedded systems.
Copyright © 2010 K Computing Use of RT-Preempt Kevin Dankwardt, Ph.D. K Computing
Inside The RT Patch Steven Rostedt (Red Hat) Darren V Hart (IBM) Talk: Benchmarks :
Inside The RT Patch Steven Rostedt (Red Hat) Darren V Hart (IBM) Talk: Benchmarks :
Real Time patch BOF on OLS Friday, July 21, :00 – 13:45 Room D Steven Rostedt Klaas van Gend.
CPU Scheduling Scheduling processes (or kernel-level threads) onto the cpu is one of the most important OS functions. The cpu is an expensive resource.
Inside The RT Patch Steven Rostedt (Red Hat) Darren V Hart (IBM) Talk: Benchmarks :
REAL-TIME OPERATING SYSTEMS
Linux Realtime Preemption and Its Impact on ULDD* - Progress Report -
Realtime Linux Clark Williams Tech Lead
EEE 6494 Embedded Systems Design
Real-Time Operating Systems
Chapter 2: The Linux System Part 3
Operating systems Process scheduling.
CPU SCHEDULING.
Operating Systems Real-Time Operating Systems
Supporting Time-Sensitive Applications on a Commodity OS
Scheduling Classes and Real-Time Scheduling in Linux
Linux Scheduling CSE 2431: Introduction to Operating Systems
Presentation transcript:

Real Time System with MVL

© 2007 MontaVista Confidential | Overview of MontaVista Agenda Why Linux Real Time? Linux Kernel Scheduler Linux RT technology Making Real-Time systems MontaVista’s Solution for Real Time

© 2007 MontaVista Confidential | Overview of MontaVista Why Linux Real Time? Linux is good because It is open source It is robust It is feature rich And much more… However Real Time is also needed for some applications Requiring deterministic response time

© 2007 MontaVista Confidential | Overview of MontaVista Things to know H/W DelayVectoringDispatchISR / Driver Interrupt Latency Off-timeKernelSchedulerTaskInterrupt LatencyContext Switch Preemption or Task Response Latency

© 2007 MontaVista Confidential | Overview of MontaVista Linux Kernel Scheduler O(1) Scheduler Deterministic scheduler overhead regardless of # of tasks Supports task priority: 0 ~ 99 default Supports scheduling policy  SCHED_OTHER, SCHED_RR and SCHED_FIFO The default scheduler for Linux 2.6.x kernels Reduces scheduling latency Completely Fair Scheduler (CFS)? It is not for Real Time applications Good for server and desktop

© 2007 MontaVista Confidential | Overview of MontaVista Priority based scheduling … 50 … 1 0(-19) … 39(20) Real-time processes Normal processes SCHED_OTHER SCHED_FIFO SCHED_RR Dynamic priority Static priority SCHED_FIFO * Nice value is not a static priority

© 2007 MontaVista Confidential | Overview of MontaVista Preemptive Kernel Introduced by Rover Love (former MontaVista employee) Utilizes spin_lock / spin_unlock to protect kernel critical sections Supports kernel preemption Reduces preemption latency Preemption point At the end of interrupt handler At the end of system call At the end of spin_unlock But not in between spin_lock and spin_unlock

© 2007 MontaVista Confidential | Overview of MontaVista Voluntary Preemption By Ingor Molnar (RedHat) Adds more ‘explicit preemption points’ Minimize the maximum latency of rescheduling Reduces preemption latency might_sleep() is the key You can find many of this calls in the kernel source Normally in the loop code Valid only when CONFIG_PREEMPT_VOLUNTARY is set

© 2007 MontaVista Confidential | Overview of MontaVista Mutual Exclusion (MUTEX) Priority Inheritance Mutex – Kernel Converts spin_lock to priority inheritance mutex  When CONFIG_PREEMPT_RT is set  Transparent to kernel code: syntax is still same Enables preemption between spin_lock and spin_unlock New raw_spinlock_t  Should be used where mutex can not be used  Syntax is still same: spin_lock and spin_unlock  Spin_lock appropriately handles it depending on the type Fast User Mutex (FUTEX) – Applications Utilizes kernel priority inheritance mutex No kernel call when there is no contention

© 2007 MontaVista Confidential | Overview of MontaVista Priority Inheritance Mutex Medium Prio Task (M) Low Prio Task (L) Kernel (scheduler) Medium Prio Task x High Priority Task (H) Locks Mutex Tries to get Mutex Unlocks Mutex Gets Mutex

© 2007 MontaVista Confidential | Overview of MontaVista Threaded Interrupt Handler Interupt handler is called by a kernel interrupt handler thread The interrupt handler thread is assigned a task priority Minimizes interrupt latency thus preemption latency as well Does not content with RT tasks Flexible system design  Can assign a higher priority on an important task Default for PREEMPT_RT and optional for others IRQF_NODELAY is needed  For timers and etc.  Interrupt handler can not make use of spin_lock

© 2007 MontaVista Confidential | Overview of MontaVista Threaded Interrupt Handler (2) IRQ Thread H/W Interrupt Kernel (scheduler) Running Task (L) High Priority Task (H) Minimized Latency IRQ Thread wake-up

© 2007 MontaVista Confidential | Overview of MontaVista Voluntary Preemption Preemptible Kernel Preemption mode comparison PreemptibleNon-Preemptible No Preemption Realtime Preemption

© 2007 MontaVista Confidential | Overview of MontaVista Improved latency

© 2007 MontaVista Confidential | Overview of MontaVista System Design Theory You should only have one highest priority process* IO-bound  control algorithms are IO-bound: they start and end with IO Finite time running guarantee on your process  Definitely NO infinite loops! sum(total running time + 2 x scheduler run) < latency req. Scheduler Highest Priority Other tasks

© 2007 MontaVista Confidential | Overview of MontaVista Mistake: priority design Be careful! Ksoftirqd manages: High-res timers NAPI (network!) Some blockdevice stuff IRQs might have wrong prio Does your RT apps need something from (soft)IRQs? 0 99 regular apps threaded IRQs ksoftirqd watchdog thread migration Your RT app here??? non-RT app here???

© 2007 MontaVista Confidential | Overview of MontaVista 17 Mistake: “running at prio 99 froze my system” testrt.c: #include int main(void) { set_my_priority_to_highest(); while (true) {;} return 0; } or: while (someVolatile != -1) { sched_yield(); }

© 2007 MontaVista Confidential | Overview of MontaVista 18 Throughput High responsiveness Real-Time Response vs. Throughput Efficiency and Responsiveness are Inversely Related Overhead for Real-Time Preemption Mutex Operations more complex than Spinlock Operations Priority Inheritance on Mutex increases Task Switching Priority Inheritance increases Worst-Case Execution Time Design flexibility allows much better worst case scenarios Real-time tasks are designed to use kernel resources in managed ways then delays can be eliminated or reduced

© 2007 MontaVista Confidential | Overview of MontaVista MontaVista Linux 5.0 Real-Time Kernel features for Real-Time All previous features plus more… Kernel ( & 20 backports) Real-Time for Linux native applications Default Thread model : NPTL Priority Queueing for Mutex/Semaphore Priority Inheritance Mutex Robust Mutex

Questions and Answers

Thank You