Case Study: Challenges and Benefits in Integrating Real Time patch in PowerPc Based Media System

Size: px
Start display at page:

Download "Case Study: Challenges and Benefits in Integrating Real Time patch in PowerPc Based Media System"

Transcription

1 Case Study: Challenges and Benefits in Integrating Real Time patch in PowerPc Based Media System Manikandan Ramachandran Infosys Technologies Limited Electronic City, Hosur Road, Bengaluru ,India mani Aviral Pandey Motorola Mobility 2450 Walsh Avenue,Santa Clara, CA 95051, USA Abstract Media systems generally have many CPU intensive as well as time critical processes. Vanilla Linux 2.6 with preemption enabled does provide solution to this kind of system. However, if the system is interrupt intensive, as ours, then vanilla Linux 2.6 performance is not expected to be good; as by definition interrupt preempts all higher priority tasks. RT patch seems to address exact issue by providing an option to handle interrupts in process context, but the solution address exact issue by providing an option to handle interrupts in process context, but the solution doesn t seem to fit customized Linux. Quite a bit of architecture changes had to be made to reap the benefits of RT patch. This paper describes about various challenges faced in integrating Ingo s RT patch on a customized PowerPc Linux package. And explains how those challenges were overcome. It describes how LTTng can be used to identify the bottlenecks and finally concludes by comparing performance of the application that was run on vanilla and RT Linux. 1

2 1 Introduction Linux operating system is evolving fast as a defacto embedded operating system. Looking back the community has made tremendous progress from being stuck with big-o-lock to a really preemptible kernel in 2.6, and to fairly predictable kernel with RT patch. However,still there are few challenges in using Linux for commercial systems that require real-time capabilities. This paper takes one of such case and walks through the challenges in integrating RT patch along with slew of other patches. After all the effort in integrating, the real performance of the system is not up to the expectation. The paper dwells deeper into a performance issue and proposes a solution to fix that issue. 2 Product Overview The system identified for this study is a head-end media device. The device is a real time video splicer and statiscal remultiplexer that can groom hundreds of video services. The device has 2 PowerPc 7448, built on a Marvell communication controller board [MV64460]. Real MPEG related operation is done by a proprietary application that is highly CPU intensive and it has the highest priority among all processes. In short, proprietary application almost expects hard real time capability from the operating system. The figure below gives intended hierarchy of CPU resource to be utilized by various processes/interrupts. 3 Problem Statement The most important goal of the product software designis that wheneverthereis aninterrupt fromvideo hardware, kernel has to schedule video processing tasks with almost zero latency. In theory assigning high real time priority should take care of this requirement; however in few instances it has been demonstrated that Linux kernel has failed to honor priority of tasks because of various other kernel dependencies. Linux Trace Tool next generation or LTTng is an open source tool that helps to find performance bottle neck on Linux based system. Using LTTng, following system bottlenecks were identified: 3.1 Multiple IDE interrupts The media product has two compact flashes each of which can be accessed through kernel s IDE driver. Any access to compact flash generates lot of interrupts that could preempt the high priority application process and cause degradation in system performance. This issue was kind of mitigated by deferring IDE request by 1 millisecond, think of it like yielding CPU to other tasks before scheduling another IDE request. This feature ensures that there is only one IDE interrupt during 1 millisecond window. This solution seems to work; however in certain condition, when there is excessive IDE access, LTTng shows that more than 1 IDE interrupt could occur in 1 millisecond window. FIGURE 2: IDE interrupt in video process context FIGURE 1: Processes Hierarchy This scenario happens when video hardware interrupts and IDE interrupts are handled one after the other. Figure 2[Refer Appendix A for legend] is a capture of LTTng viewer. Marker 1 and Marker 2

3 2. shows that there are more than 1 IDE interrupts while application process is woken up by video interrupt. Marker 3 just shows the events that occurred around Marker Softirqs preempts high priority process Linux kernel is driven by timer interrupts. Whenever there is timer interrupt, scheduler is woken up and deferred tasks are executed from.softirq. context. The occurrences of timer interrupt can be configured. In our kernel we have configured that to be 1 millisecond. So every 1 millisecond, softirq daemon is woken up and it preempts all other high priority tasks. Usually softirq daemon doesn t hog CPU [it would take microseconds], but if there are many kernel soft timers registered it could hog the CPU. In oursystemthere are2scenariosin which spinlock usage is inevitable: Custom drivers handling interrupts or to provide mutual exclusion to critical resource. Kernel usage of spinlocks. One common instance is usage of spinlocks in printk function. 4 A Case for Real-Time Patch Real-time patch [3] provides following features that make the kernel more preemptible: Makes spinlocks preemptible by default. Option to handle IRQs in kernel thread context instead of IRQ context. Softirqs are handled in kernel threads context. Our study about system performance issues with vanilla kernel made a compelling argument for using RT patch. We thought by using RT patch we could address our system performance issues. Based on that thought we made following changes to our system software architecture: FIGURE 3: softirq stealing video process context In Figure 3, marker points to context switch from application process to softirq daemon. In this case few micro seconds are lost from application process context. 3.3 Spinlocks and Preemption In multiprocessor system spinlocks are used to provide mutual exclusion for any critical resource. SpinlocksbyitsnaturedisablespreemptioninCPUofthe current process. So if a lower priority process happens to take spinlock before a higher priority tasks scheduled to run, then as long as spinlock is held by the lower priority task, higher priority is task is starved for CPU time. This is one scenario, where priority of process fails to get honored. Apply RT patchto ourkernelandmakedrivers compatible to that. All interrupts except video hardware interrupts were made to handle as kernel threads. Priority of Application process was made higher than interrupt and softirq threads. The idea of new design is that whenever there is a video interrupt, media process is woken up with zero or little latency. Another expectation from RT patch is that, the feedback mechanism used in IDE driver tothrottleiderequestcanberemovedandrtpatch would inherently take care of preempting low priority tasks including tasks that handle interrupts. 5 Challenges in Integrating RT-patch The end goal of this exercise was to have a stable real-time Linux kernel and have performance profiling capability by integrating LTTng. At the time of this exercise was the latest and stable kernel 3

4 version so we choose real-time patch version and LTTng version [version]. Patch process went about quite smoothly, but we had following run time issues: 1 Unable to boot the System in SMP mode: The cause of this issue was found to be with calling kzalloc from setup cpu. Apparently this issue is not seen in non-real-time kernel. We worked around this issue by statically allocating memory rather than using kzalloc or kmalloc. 2 Dependency on BSP code: When used realtime patch over Marvell s BSP code, we found lot of recursive locks issues. We identified those issues and fixed them. 3 Handling IRQ in a Thread: This is one of the toughest challenges that we are dealing with. In first look, after booting real-time kernel one would think that interrupts are handled in Interrupt threads, but we found it in hard way that interrupts continue to get handled in interrupt context unless a few specific changes are made[4]. This issue is the main point of this paper, and it is discussed in detail in section Performance Analysis. 6 Performance Measure After applying real-time patch we tried to get raw performance measure of our system using Cyclic testr [5] and the actual application performance in a controlled test environment. From cyclic test, we noticed that the performance of the system was similar to vanilla kernel. However, with our custom product performance test we found that the performance of the application has deteriorated a lot. Following section describes our test scenario and results. 6.1 Kernel Performance Measure Cyclic test is used to determine the internal worstcase latency of a Linux real-time system. Cyclitest measures the amount of time that passes between when a timer expires and when the thread actually runs the thread is woken[9]. We used this tool in both patched real-time kernel and vanilla kernel. The Cyclic test test was run with following parameter set: one thread with priority 80 Thread to run tight loops Interval between each loops micro seconds We conducted this test in 2 phases. In first phase, all application was stopped and made sure CPU utilization was less than 1% on both CPU. Then we ran cyclic test first with vanilla kernel then cyclic test was ran on kernel with real-time patch. Results of the test are given in Figure-4. FIGURE 4: Cyclic Test with No Load In second phase, both CPUs of the system were heavily loaded using a script that just creates a tight loop. Multiple instances of this script were run concurrently till the CPU utilization of the system reached 97%. Cyclic test was run in this loaded scenario. Figure 5 gives the result of cyclic test on both kernels. FIGURE 5: Cyclic Test with Load Inference From figure 4 we see that the minimum latency for vanilla kernel is 896 microseconds which is less than real-time patched kernel. While maximum latency for real-time patched kernel is more than 1milliseonds which is far worst than vannila kernel. From figure 5, we can infer that latency isnr t bad with loaded system. Both for vanilla and realpatched kernel we see the difference is only about 10 micro seconds. 4

5 The conclusion of this test is that we don t observe huge improvement in performance of the kernel/system with real-time patch. 6.2 Application Performance Measure The idea behind this performance test is to study how vanilla and real-time patched kernel behaves when a high priority process is made to starve for CPU time. Since real-time patch has option to handle interrupts in process context and makes normal spinlocks preemptible, the expectation and the desire was that the real-time patched kernel always honors process.s priority irrespective of other processes or kernel state. In our case, Media application is configured to have higher priority than all other processes, including processes that are supposed to handle interrupts Test Case Description The Media application was configured to run at full capacity, so that CPU resource is solely taken by this process. Executions of other trivial tasks were reduced. Thetestwasthenrunon3differentkernels: [scheduler based on RB-tree] [CFS scheduler] RT patch FIGURE 7: CPU1 load comparison Figure6and 7 comparesthe performanceof each kernel while the process was stressed for 30 minutes Inference From Figure 6 and Figure 7 it is apparent that application performance on real-time patch kernel is not better than its performance on vanilla kernel. Only difference between real-time patch kernel and vanilla kernel from a platform perspective is that a patch to throttle IDE access was not ported to real-time kernel. TomakesureIDEaccessis the causeofthe issue, excessive IDE access was made when media application process was fully loaded. Under this scenario, we found that the performance of the application deteriorated further. Ideally a process that handles IDEinterrupts should have yielded to high priority task processes like the media application process; however, from this test it looks like media application process seems to be preempted when there is an IDE interrupt. 7 Application Performance Analysis FIGURE 6: CPU0 load comparison After making the kernel real-time enabled, the expectation was that the IRQ thread will be preempted by high priority media application process. However, as demonstrated in previous section, we have seen that performance of the application was not good with real-time patched kernel. There could be two possibilities for this kind of behavior: 1. Scheduler is not honoring processes priority. 5

6 2. IDE interrupts are still handled in interrupt context like vanilla kernel. Weconfirmed Case1 isnotthecasebyrunning rt-migrate-test written by Steven Rostedt[6]. This is a simple program that creates multiple threads with various priority and then checks if scheduler honors the priority of each thread. This test passed both in normal scenario and in heavily loaded system with IDE interrupts and media application process. To check if IDE interrupts are still handled in interrupt context, we patched real-time kernel with LTTng. Then with patched kernel, the media application was stressed while generating multiple IDE interrupts. in thread, one has to use request threaded irq and split the handling of irq into two parts by using two handler functions. In first part, interrupt will be handled in interrupt context. In this context, handler should disable the source of the interrupt and wake corresponding interrupt thread. The second handler should do the actual handling of the interrupt, which obviously will be done in the thread context. Having identified the bottleneck, we are in process of converting IDE and other similar CPU intensive interrupt handlers to be run in thread context. 9 Future Work 9.1 Creating thread function for interrupt handling As discussed in section 8, just having real-time patch is not go enough for making interrupts to be handled in threads. A thread function, which handles deferred interrupt work, should be designed and implemented. In future, we intend to make low priority interrupts that are CPU intensive to be handled in threads. 9.2 High Resolution Timers FIGURE 8: Video Process being preempted by interrupts Figure 8 captures the various process states at the time of the issue. irq75-ide1 is the handler process for the IDE interrupt: in this case IDE interrupt number is 75.From the viewer, we can interpret that video process was starved for CPU as it was busy handling IDE interrupt 75 in interrupt context rather than in the context of the thread irq75-ide1. This is the cause of video process starvation. 8 Solution We started looking into request irq implementation in real-time patched kernel to understand why IDE interrupts were handled in interrupt context not in thread context. From request irq implementation it was clear that irq thread did nothing if handlers for an interrupt were installed through request irq call. In order for interrupt to be handled We didn.t enable.high Resolution Timers. in any of the current kernel configuration as we weren.t sure about the support of this feature in PowerPc based system [8]. In future, we intend to do deep profile of kernel performance with high resolution timers. 10 Conclusion Effectiveness of real-time patch on a system depends on various factors. In our case, preemption of IRQ handler is the single most important criteria in determining system performance. Although real-time patch creates interrupt threads by default, it really doesn.t mean that interrupts are handled in those threads. This behavior confuses the user. Instead, it would have been better if no interrupt threads were created. If one prefers to have an interrupt threaded then he or she may do so by using request threaded irq. This case study shows that applying real-time patch will not solve all real time requirements of a system. Instead it provides great tools like preemptive spinlocks, threaded interrupt handler etcetera. 6

7 To make a system near real time capable, one has to understand their system bottlenecks. LTTng is a great tool which clearly brings out hard to understand system behavior. As demonstrated in this case, LTTng was used extensively to get to bottom of many performance issues. It is highly recommended to use LTTng to understand system performance issues and make few system software architecture changes to take advantage of tools provided by real-time patch. To summarize, real-time patch is not a cure-all of all system real-time owes; instead it provides great tools that could be used as the first step to make a system real time capable. References [8] High resolution timers and dynamic ticks design notes [linux/documentation/timers/highres.txt] [9] rt-latency-howto.txt [ A Appendix Following is the legend for LTTV output. Source: guide/x81.html. [1] Introduction to LTTng [ [2] How to Use LTTV [ [3] Introduction to RealTime Patch[ [4] Cyclictest examples [ [5] Moving interrupts to thread by Jake Edge.[ [6] Real Time Threads [7] Investigating latency effects of the Linux realtime Preemption Patches (PREEMPT RT) on AMDs GEODE LX Platform FIGURE 9: Lengend For LTTV 7

Real Time Linux patches: history and usage

Real Time Linux patches: history and usage Real Time Linux patches: history and usage Presentation first given at: FOSDEM 2006 Embedded Development Room See www.fosdem.org Klaas van Gend Field Application Engineer for Europe Why Linux in Real-Time

More information

Evaluation of uclinux and PREEMPT_RT for Machine Control System

Evaluation of uclinux and PREEMPT_RT for Machine Control System Evaluation of uclinux and PREEMPT_RT for Machine Control System 2014/05/20 Hitachi, Ltd. Yokohama Research Lab Linux Technology Center Yoshihiro Hayashi yoshihiro.hayashi.cd@hitachi.com Agenda 1. Background

More information

A TimeSys Perspective on the Linux Preemptible Kernel Version 1.0. White Paper

A TimeSys Perspective on the Linux Preemptible Kernel Version 1.0. White Paper A TimeSys Perspective on the Linux Preemptible Kernel Version 1.0 White Paper A TimeSys Perspective on the Linux Preemptible Kernel A White Paper from TimeSys Corporation Introduction One of the most basic

More information

Real-Time Technology in Linux

Real-Time Technology in Linux Real-Time Technology in Linux Sven-Thorsten Dietrich Real-Time Architect Introductions MontaVista Software is a leading global supplier of systems software and development tools for intelligent connected

More information

How Linux RT_PREEMPT Works

How Linux RT_PREEMPT Works How Linux RT_PREEMPT Works A common observation about real time systems is that the cost of the increased determinism of real time is decreased throughput and increased average latency. This presentation

More information

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Week 05 Lecture 18 CPU Scheduling Hello. In this lecture, we

More information

Measuring the impacts of the Preempt-RT patch

Measuring the impacts of the Preempt-RT patch Measuring the impacts of the Preempt-RT patch maxime.chevallier@smile.fr October 25, 2017 RT Linux projects Simulation platform : bi-xeon, lots ot RAM 200µs wakeup latency, networking Test bench : Intel

More information

Utilizing Linux Kernel Components in K42 K42 Team modified October 2001

Utilizing Linux Kernel Components in K42 K42 Team modified October 2001 K42 Team modified October 2001 This paper discusses how K42 uses Linux-kernel components to support a wide range of hardware, a full-featured TCP/IP stack and Linux file-systems. An examination of the

More information

Real-Time and Performance Improvements in the

Real-Time and Performance Improvements in the 1 of 7 6/18/2006 8:21 PM Real-Time and Performance Improvements in the 2.6 Linux Kernel William von Hagen Abstract Work on improving the responsiveness and real-time performance of the Linux kernel holds

More information

Review of the Stable Realtime Release Process

Review of the Stable Realtime Release Process Review of the Stable Realtime Release Process An unscientific, slightly opinionated stab at the current status... With the intent of generating some discussion. Frank Rowand, Sony Network Entertainment

More information

Evaluation of Real-time Performance in Embedded Linux. Hiraku Toyooka, Hitachi. LinuxCon Europe Hitachi, Ltd All rights reserved.

Evaluation of Real-time Performance in Embedded Linux. Hiraku Toyooka, Hitachi. LinuxCon Europe Hitachi, Ltd All rights reserved. Evaluation of Real-time Performance in Embedded Linux LinuxCon Europe 2014 Hiraku Toyooka, Hitachi 1 whoami Hiraku Toyooka Software engineer at Hitachi " Working on operating systems Linux (mainly) for

More information

Latency on preemptible Real-Time Linux

Latency on preemptible Real-Time Linux Appendix 1 Latency on preemptible Real-Time Linux on DCP-SH7780 Contents 1.1 Getting Started.......................................... 1 1.2 Rtrtc Driver........................................... 2 1.3

More information

Linux - Not real-time!

Linux - Not real-time! Linux - Not real-time! Date: 16.01.2015 Author(s): Michal Koziel www.bitvis.no 1 Abstract A system is said to be real-time if it can respond to external triggers and perform periodic tasks with deterministic

More information

Real-time in embedded Linux systems

Real-time in embedded Linux systems Real-time in embedded Linux systems Michael Opdenacker Copyright 2004-2011, Free Electrons. Creative Commons BY-SA 3.0 license Latest update: Nov 2, 2011, Document sources, updates and translations: http://free-electrons.com/docs/realtime

More information

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time

More information

Abstract. Testing Parameters. Introduction. Hardware Platform. Native System

Abstract. Testing Parameters. Introduction. Hardware Platform. Native System Abstract In this paper, we address the latency issue in RT- XEN virtual machines that are available in Xen 4.5. Despite the advantages of applying virtualization to systems, the default credit scheduler

More information

Adventures In Real-Time Performance Tuning, Part 2

Adventures In Real-Time Performance Tuning, Part 2 Adventures In Real-Time Performance Tuning, Part 2 The real-time for Linux patchset does not guarantee adequate real-time behavior for all target platforms. When using real-time Linux on a new platform

More information

238P: Operating Systems. Lecture 14: Process scheduling

238P: Operating Systems. Lecture 14: Process scheduling 238P: Operating Systems Lecture 14: Process scheduling This lecture is heavily based on the material developed by Don Porter Anton Burtsev November, 2017 Cooperative vs preemptive What is cooperative multitasking?

More information

LECTURE 3:CPU SCHEDULING

LECTURE 3:CPU SCHEDULING LECTURE 3:CPU SCHEDULING 1 Outline Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time CPU Scheduling Operating Systems Examples Algorithm Evaluation 2 Objectives

More information

Operating System Performance and Large Servers 1

Operating System Performance and Large Servers 1 Operating System Performance and Large Servers 1 Hyuck Yoo and Keng-Tai Ko Sun Microsystems, Inc. Mountain View, CA 94043 Abstract Servers are an essential part of today's computing environments. High

More information

ADVANCED trouble-shooting of real-time systems. Bernd Hufmann, Ericsson

ADVANCED trouble-shooting of real-time systems. Bernd Hufmann, Ericsson ADVANCED trouble-shooting of real-time systems Bernd Hufmann, Ericsson AGENDA 1 Introduction 2 3 Timing Analysis 4 References 5 Q&A Trace Compass Overview ADVANCED trouble-shooting of critical real-time

More information

Barrelfish Project ETH Zurich. Message Notifications

Barrelfish Project ETH Zurich. Message Notifications Barrelfish Project ETH Zurich Message Notifications Barrelfish Technical Note 9 Barrelfish project 16.06.2010 Systems Group Department of Computer Science ETH Zurich CAB F.79, Universitätstrasse 6, Zurich

More information

Realtime BoF Session RealTime Testing Best Practice of RealTime WG YungJoon Jung

Realtime BoF Session RealTime Testing Best Practice of RealTime WG YungJoon Jung Realtime BoF Session RealTime Testing Best Practice of RealTime WG YungJoon Jung April 15th, 2008 CE Linux Forum 1 Contents Introduction Current RealTime Testing Methods Plan April 15th, 2008 CE Linux

More information

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013) CPU Scheduling Daniel Mosse (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013) Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU I/O Burst Cycle Process

More information

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time

More information

Two Real-Time Operating Systems and Their Scheduling Algorithms: QNX vs. RTLinux

Two Real-Time Operating Systems and Their Scheduling Algorithms: QNX vs. RTLinux Two Real-Time Operating Systems and Their Scheduling Algorithms: QNX vs. RTLinux Daniel Svärd dansv077@student.liu.se Freddie Åström freas157@student.liu.se November 19, 2006 Abstract This report tries

More information

Multi-Level Feedback Queues

Multi-Level Feedback Queues CS 326: Operating Systems Multi-Level Feedback Queues Lecture 8 Today s Schedule Building an Ideal Scheduler Priority-Based Scheduling Multi-Level Queues Multi-Level Feedback Queues Scheduling Domains

More information

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 05 Lecture - 21 Scheduling in Linux (O(n) and O(1) Scheduler)

More information

COSC243 Part 2: Operating Systems

COSC243 Part 2: Operating Systems COSC243 Part 2: Operating Systems Lecture 17: CPU Scheduling Zhiyi Huang Dept. of Computer Science, University of Otago Zhiyi Huang (Otago) COSC243 Lecture 17 1 / 30 Overview Last lecture: Cooperating

More information

Chapter 6: CPU Scheduling

Chapter 6: CPU Scheduling Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 10 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Chapter 6: CPU Scheduling Basic Concepts

More information

Performance Evaluation of Xenomai 3

Performance Evaluation of Xenomai 3 Performance Evaluation of Xenomai 3 Ching-Chun (Jim) Huang **, Chan-Hsiang Lin **, and Che-Kang Wu * * Department of Computer Science and Information Engineering, National Cheng Kung University, Taiwan

More information

Chapter 5: CPU Scheduling

Chapter 5: CPU Scheduling Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm Evaluation Chapter 5: CPU Scheduling

More information

Scheduling - Overview

Scheduling - Overview Scheduling - Overview Quick review of textbook scheduling Linux 2.4 scheduler implementation overview Linux 2.4 scheduler code Modified Linux 2.4 scheduler Linux 2.6 scheduler comments Possible Goals of

More information

Low Disturbance Embedded System Tracing with Linux Trace Toolkit Next Generation

Low Disturbance Embedded System Tracing with Linux Trace Toolkit Next Generation Low Disturbance Embedded System Tracing with Linux Trace Toolkit Next Generation Mathieu Desnoyers École Polytechnique de Montréal mathieu.desnoyers@polymtl.ca Michel R. Dagenais École Polytechnique de

More information

Timers 1 / 46. Jiffies. Potent and Evil Magic

Timers 1 / 46. Jiffies. Potent and Evil Magic Timers 1 / 46 Jiffies Each timer tick, a variable called jiffies is incremented It is thus (roughly) the number of HZ since system boot A 32-bit counter incremented at 1000 Hz wraps around in about 50

More information

Inferring Temporal Behaviours Through Kernel Tracing

Inferring Temporal Behaviours Through Kernel Tracing Inferring Temporal Behaviours Through Kernel Tracing Paolo Rallo, Nicola Manica, Luca Abeni University of Trento Trento - Italy prallo@gmail.com, nicola.manica@disi.unitn.it, luca.abeni@unitn.it Technical

More information

Last Time. Think carefully about whether you use a heap Look carefully for stack overflow Especially when you have multiple threads

Last Time. Think carefully about whether you use a heap Look carefully for stack overflow Especially when you have multiple threads Last Time Cost of nearly full resources RAM is limited Think carefully about whether you use a heap Look carefully for stack overflow Especially when you have multiple threads Embedded C Extensions for

More information

Analysis and Research on Improving Real-time Performance of Linux Kernel

Analysis and Research on Improving Real-time Performance of Linux Kernel Analysis and Research on Improving Real-time Performance of Linux Kernel BI Chun-yue School of Electronics and Computer/ Zhejiang Wanli University/Ningbo, China ABSTRACT With the widespread application

More information

CS3733: Operating Systems

CS3733: Operating Systems CS3733: Operating Systems Topics: Process (CPU) Scheduling (SGG 5.1-5.3, 6.7 and web notes) Instructor: Dr. Dakai Zhu 1 Updates and Q&A Homework-02: late submission allowed until Friday!! Submit on Blackboard

More information

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University CS 571 Operating Systems Midterm Review Angelos Stavrou, George Mason University Class Midterm: Grading 2 Grading Midterm: 25% Theory Part 60% (1h 30m) Programming Part 40% (1h) Theory Part (Closed Books):

More information

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

CPU Scheduling. Operating Systems (Fall/Winter 2018) Yajin Zhou (  Zhejiang University Operating Systems (Fall/Winter 2018) CPU Scheduling Yajin Zhou (http://yajin.org) Zhejiang University Acknowledgement: some pages are based on the slides from Zhi Wang(fsu). Review Motivation to use threads

More information

Supporting Time-sensitive Applications on a Commodity OS

Supporting Time-sensitive Applications on a Commodity OS Supporting Time-sensitive Applications on a Commodity OS Ashvin Goel, Luca Abeni, Charles Krasic, Jim Snow, Jonathan Walpole Department of Computer Science and Engineering Oregon Graduate Institute, Portland

More information

Reservation-Based Scheduling for IRQ Threads

Reservation-Based Scheduling for IRQ Threads Reservation-Based Scheduling for IRQ Threads Luca Abeni, Nicola Manica, Luigi Palopoli luca.abeni@unitn.it, nicola.manica@gmail.com, palopoli@dit.unitn.it University of Trento, Trento - Italy Reservation-Based

More information

Multiprocessor and Real- Time Scheduling. Chapter 10

Multiprocessor and Real- Time Scheduling. Chapter 10 Multiprocessor and Real- Time Scheduling Chapter 10 Classifications of Multiprocessor Loosely coupled multiprocessor each processor has its own memory and I/O channels Functionally specialized processors

More information

L4-Linux Based System As A Platform For EPICS ioccore

L4-Linux Based System As A Platform For EPICS ioccore L4-Linux Based System As A Platform For EPICS ioccore J. Odagiri, N. Yamamoto and T. Katoh High Energy Research Accelerator Organization, KEK ICALEPCS 2001, Nov 28, San Jose Contents Backgrounds Causes

More information

Advanced Operating Systems (CS 202) Scheduling (2)

Advanced Operating Systems (CS 202) Scheduling (2) Advanced Operating Systems (CS 202) Scheduling (2) Lottery Scheduling 2 2 2 Problems with Traditional schedulers Priority systems are ad hoc: highest priority always wins Try to support fair share by adjusting

More information

Comparison of Real-Time Scheduling in VxWorks and RTLinux

Comparison of Real-Time Scheduling in VxWorks and RTLinux Comparison of Real-Time Scheduling in VxWorks and RTLinux TDDB72: Concurrent Programming, Operating Systems, and Real-Time Operating Systems Jacob Siverskog jacsi169@student.liu.se Marcus Stavström marst177@student.liu.se

More information

Tasks. Task Implementation and management

Tasks. Task Implementation and management Tasks Task Implementation and management Tasks Vocab Absolute time - real world time Relative time - time referenced to some event Interval - any slice of time characterized by start & end times Duration

More information

A comparison between the scheduling algorithms used in RTLinux and in VxWorks - both from a theoretical and a contextual view

A comparison between the scheduling algorithms used in RTLinux and in VxWorks - both from a theoretical and a contextual view A comparison between the scheduling algorithms used in RTLinux and in VxWorks - both from a theoretical and a contextual view Authors and Affiliation Oskar Hermansson and Stefan Holmer studying the third

More information

Operating Systems. Process scheduling. Thomas Ropars.

Operating Systems. Process scheduling. Thomas Ropars. 1 Operating Systems Process scheduling Thomas Ropars thomas.ropars@univ-grenoble-alpes.fr 2018 References The content of these lectures is inspired by: The lecture notes of Renaud Lachaize. The lecture

More information

Scheduling. Scheduling 1/51

Scheduling. Scheduling 1/51 Scheduling 1/51 Scheduler Scheduling Scheduler allocates cpu(s) to threads and processes. This action is known as scheduling. The scheduler is a part of the process manager code that handles scheduling.

More information

Concurrency Race Conditions and Deadlocks

Concurrency Race Conditions and Deadlocks Concurrency Race Conditions and Deadlocks Kartik Gopalan Chapters 2 (2.3) and 6 Tanenbaum s Modern OS Sequential Loosely, doing many things, but one after another E.g. Finish one assignment, then another

More information

Hardware Latencies How to flush them out (A use case) Steven Rostedt Red Hat

Hardware Latencies How to flush them out (A use case) Steven Rostedt Red Hat Hardware Latencies How to flush them out (A use case) Steven Rostedt Red Hat Here s a story, of a lovely lady... No this isn t the Brady Bunch Nor is it about a lovely lady But it probably could have been

More information

CS 326: Operating Systems. CPU Scheduling. Lecture 6

CS 326: Operating Systems. CPU Scheduling. Lecture 6 CS 326: Operating Systems CPU Scheduling Lecture 6 Today s Schedule Agenda? Context Switches and Interrupts Basic Scheduling Algorithms Scheduling with I/O Symmetric multiprocessing 2/7/18 CS 326: Operating

More information

Midterm Exam Amy Murphy 19 March 2003

Midterm Exam Amy Murphy 19 March 2003 University of Rochester Midterm Exam Amy Murphy 19 March 2003 Computer Systems (CSC2/456) Read before beginning: Please write clearly. Illegible answers cannot be graded. Be sure to identify all of your

More information

Locks. Dongkun Shin, SKKU

Locks. Dongkun Shin, SKKU Locks 1 Locks: The Basic Idea To implement a critical section A lock variable must be declared A lock variable holds the state of the lock Available (unlocked, free) Acquired (locked, held) Exactly one

More information

Concurrency. Glossary

Concurrency. Glossary Glossary atomic Executing as a single unit or block of computation. An atomic section of code is said to have transactional semantics. No intermediate state for the code unit is visible outside of the

More information

Comparison of soft real-time CPU scheduling in Linux kernel 2.6 series with Solaris 10

Comparison of soft real-time CPU scheduling in Linux kernel 2.6 series with Solaris 10 Comparison of soft real-time CPU scheduling in Linux kernel 2.6 series with Solaris 10 Kristoffer Eriksson Philip Frising Department of Computer and Information Science Linköping University 1(15) 1. About

More information

Scheduling. Scheduling 1/51

Scheduling. Scheduling 1/51 Scheduling 1/51 Learning Objectives Scheduling To understand the role of a scheduler in an operating system To understand the scheduling mechanism To understand scheduling strategies such as non-preemptive

More information

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date: Subject Name: OPERATING SYSTEMS Subject Code: 10EC65 Prepared By: Kala H S and Remya R Department: ECE Date: Unit 7 SCHEDULING TOPICS TO BE COVERED Preliminaries Non-preemptive scheduling policies Preemptive

More information

Multitasking and scheduling

Multitasking and scheduling Multitasking and scheduling Guillaume Salagnac Insa-Lyon IST Semester Fall 2017 2/39 Previously on IST-OPS: kernel vs userland pplication 1 pplication 2 VM1 VM2 OS Kernel rchitecture Hardware Each program

More information

Testing real-time Linux: What to test and how.

Testing real-time Linux: What to test and how. Testing real-time Linux: What to test and how. Sripathi Kodi sripathik@in.ibm.com Agenda IBM Linux Technology Center What is a real-time Operating System? Enterprise real-time Real-Time patches for Linux

More information

CSE 410 Final Exam 6/09/09. Suppose we have a memory and a direct-mapped cache with the following characteristics.

CSE 410 Final Exam 6/09/09. Suppose we have a memory and a direct-mapped cache with the following characteristics. Question 1. (10 points) (Caches) Suppose we have a memory and a direct-mapped cache with the following characteristics. Memory is byte addressable Memory addresses are 16 bits (i.e., the total memory size

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 12: Scheduling & Deadlock Priority Scheduling Priority Scheduling Choose next job based on priority» Airline checkin for first class passengers Can

More information

LINUX OPERATING SYSTEM Submitted in partial fulfillment of the requirement for the award of degree of Bachelor of Technology in Computer Science

LINUX OPERATING SYSTEM Submitted in partial fulfillment of the requirement for the award of degree of Bachelor of Technology in Computer Science A Seminar report On LINUX OPERATING SYSTEM Submitted in partial fulfillment of the requirement for the award of degree of Bachelor of Technology in Computer Science SUBMITTED TO: www.studymafia.org SUBMITTED

More information

Properties of Processes

Properties of Processes CPU Scheduling Properties of Processes CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait. CPU burst distribution: CPU Scheduler Selects from among the processes that

More information

Process & Thread Management II. Queues. Sleep() and Sleep Queues CIS 657

Process & Thread Management II. Queues. Sleep() and Sleep Queues CIS 657 Process & Thread Management II CIS 657 Queues Run queues: hold threads ready to execute Not a single ready queue; 64 queues All threads in same queue are treated as same priority Sleep queues: hold threads

More information

Process & Thread Management II CIS 657

Process & Thread Management II CIS 657 Process & Thread Management II CIS 657 Queues Run queues: hold threads ready to execute Not a single ready queue; 64 queues All threads in same queue are treated as same priority Sleep queues: hold threads

More information

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms Operating System Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts Scheduling Criteria Scheduling Algorithms OS Process Review Multicore Programming Multithreading Models Thread Libraries Implicit

More information

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski Operating Systems Design Fall 2010 Exam 1 Review Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 To a programmer, a system call looks just like a function call. Explain the difference in the underlying

More information

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13 PROCESS SCHEDULING II CS124 Operating Systems Fall 2017-2018, Lecture 13 2 Real-Time Systems Increasingly common to have systems with real-time scheduling requirements Real-time systems are driven by specific

More information

The Deadlock Lecture

The Deadlock Lecture Concurrent systems Lecture 4: Deadlock, Livelock, and Priority Inversion DrRobert N. M. Watson The Deadlock Lecture 1 Reminder from last time Multi-Reader Single-Writer (MRSW) locks Alternatives to semaphores/locks:

More information

Chapter 5 CPU scheduling

Chapter 5 CPU scheduling Chapter 5 CPU scheduling Contents Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling

More information

Enhancing Linux Scheduler Scalability

Enhancing Linux Scheduler Scalability Enhancing Linux Scheduler Scalability Mike Kravetz IBM Linux Technology Center Hubertus Franke, Shailabh Nagar, Rajan Ravindran IBM Thomas J. Watson Research Center {mkravetz,frankeh,nagar,rajancr}@us.ibm.com

More information

Using and Understanding the Real-Time Cyclictest Benchmark

Using and Understanding the Real-Time Cyclictest Benchmark Using and Understanding the Real-Time Cyclictest Benchmark Cyclictest results are the most frequently cited real-time Linux metric. The core concept of Cyclictest is very simple. However the test options

More information

Chapter 5: CPU Scheduling

Chapter 5: CPU Scheduling Chapter 5: CPU Scheduling Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm Evaluation

More information

Evaluation of Real-time operating systems for FGC controls

Evaluation of Real-time operating systems for FGC controls Evaluation of Real-time operating systems for FGC controls Konstantinos Chalas, CERN, Geneva, Switzerland September 2015 Abstract Power Converter Control for various experiments at CERN, is conducted using

More information

Chapter 5: CPU Scheduling

Chapter 5: CPU Scheduling COP 4610: Introduction to Operating Systems (Fall 2016) Chapter 5: CPU Scheduling Zhi Wang Florida State University Contents Basic concepts Scheduling criteria Scheduling algorithms Thread scheduling Multiple-processor

More information

Precept 2: Non-preemptive Scheduler. COS 318: Fall 2018

Precept 2: Non-preemptive Scheduler. COS 318: Fall 2018 Precept 2: Non-preemptive Scheduler COS 318: Fall 2018 Project 2 Schedule Precept: Monday 10/01, 7:30pm (You are here) Design Review: Monday 10/08, 3-7pm Due: Sunday 10/14, 11:55pm Project 2 Overview Goal:

More information

Operating Systems Antonio Vivace revision 4 Licensed under GPLv3

Operating Systems Antonio Vivace revision 4 Licensed under GPLv3 Operating Systems Antonio Vivace - 2016 revision 4 Licensed under GPLv3 Process Synchronization Background A cooperating process can share directly a logical address space (code, data) or share data through

More information

More on Synchronization and Deadlock

More on Synchronization and Deadlock Examples of OS Kernel Synchronization More on Synchronization and Deadlock Two processes making system calls to read/write on the same file, leading to possible race condition on the file system data structures

More information

Multimedia Systems 2011/2012

Multimedia Systems 2011/2012 Multimedia Systems 2011/2012 System Architecture Prof. Dr. Paul Müller University of Kaiserslautern Department of Computer Science Integrated Communication Systems ICSY http://www.icsy.de Sitemap 2 Hardware

More information

Chapter 5: CPU Scheduling. Operating System Concepts Essentials 8 th Edition

Chapter 5: CPU Scheduling. Operating System Concepts Essentials 8 th Edition Chapter 5: CPU Scheduling Silberschatz, Galvin and Gagne 2011 Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating

More information

Process Time. Steven M. Bellovin January 25,

Process Time. Steven M. Bellovin January 25, Multiprogramming Computers don t really run multiple programs simultaneously; it just appears that way Each process runs to completion, but intermixed with other processes Process 1 6 ticks Process 2 Process

More information

CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable)

CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable) CSL373: Lecture 5 Deadlocks (no process runnable) + Scheduling (> 1 process runnable) Past & Present Have looked at two constraints: Mutual exclusion constraint between two events is a requirement that

More information

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems Processes CS 475, Spring 2018 Concurrent & Distributed Systems Review: Abstractions 2 Review: Concurrency & Parallelism 4 different things: T1 T2 T3 T4 Concurrency: (1 processor) Time T1 T2 T3 T4 T1 T1

More information

Computer Systems Assignment 4: Scheduling and I/O

Computer Systems Assignment 4: Scheduling and I/O Autumn Term 018 Distributed Computing Computer Systems Assignment : Scheduling and I/O Assigned on: October 19, 018 1 Scheduling The following table describes tasks to be scheduled. The table contains

More information

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

Chap 7, 8: Scheduling. Dongkun Shin, SKKU Chap 7, 8: Scheduling 1 Introduction Multiprogramming Multiple processes in the system with one or more processors Increases processor utilization by organizing processes so that the processor always has

More information

KERNEL THREAD IMPLEMENTATION DETAILS. CS124 Operating Systems Winter , Lecture 9

KERNEL THREAD IMPLEMENTATION DETAILS. CS124 Operating Systems Winter , Lecture 9 KERNEL THREAD IMPLEMENTATION DETAILS CS124 Operating Systems Winter 2015-2016, Lecture 9 2 Last Time: Kernel Threads OS kernel must provide a multitasking implementation Kernel threads are the minimal

More information

Threads. Raju Pandey Department of Computer Sciences University of California, Davis Spring 2011

Threads. Raju Pandey Department of Computer Sciences University of California, Davis Spring 2011 Threads Raju Pandey Department of Computer Sciences University of California, Davis Spring 2011 Threads Effectiveness of parallel computing depends on the performance of the primitives used to express

More information

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control Interrupts and Time Real-Time Systems, Lecture 5 Martina Maggio 28 January 2016 Lund University, Department of Automatic Control Content [Real-Time Control System: Chapter 5] 1. Interrupts 2. Clock Interrupts

More information

A Comparison of Scheduling Latency in Linux, PREEMPT_RT, and LITMUS RT. Felipe Cerqueira and Björn Brandenburg

A Comparison of Scheduling Latency in Linux, PREEMPT_RT, and LITMUS RT. Felipe Cerqueira and Björn Brandenburg A Comparison of Scheduling Latency in Linux, PREEMPT_RT, and LITMUS RT Felipe Cerqueira and Björn Brandenburg July 9th, 2013 1 Linux as a Real-Time OS 2 Linux as a Real-Time OS Optimizing system responsiveness

More information

CSCE Operating Systems Scheduling. Qiang Zeng, Ph.D. Fall 2018

CSCE Operating Systems Scheduling. Qiang Zeng, Ph.D. Fall 2018 CSCE 311 - Operating Systems Scheduling Qiang Zeng, Ph.D. Fall 2018 Resource Allocation Graph describing the traffic jam CSCE 311 - Operating Systems 2 Conditions for Deadlock Mutual Exclusion Hold-and-Wait

More information

Kernels and Locking. Luca Abeni

Kernels and Locking. Luca Abeni Kernels and Locking Luca Abeni luca.abeni@santannapisa.it Critical Sections in Kernel Code Old Linux kernels used to be non-preemptable... Kernel Big critical section Mutual exclusion was not a problem...

More information

Shielded Processors: Guaranteeing Sub-millisecond Response in Standard Linux

Shielded Processors: Guaranteeing Sub-millisecond Response in Standard Linux Shielded Processors: Guaranteeing Sub-millisecond Response in Standard Linux Steve Brosky and Steve Rotolo Concurrent Computer Corporation 2881 Gateway Drive, Pompano Beach, FL 33069 Abstract The low latency

More information

Introduction to Real-Time Systems and Multitasking. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Introduction to Real-Time Systems and Multitasking. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff Introduction to Real-Time Systems and Multitasking Real-time systems Real-time system: A system that must respond to signals within explicit and bounded time requirements Categories Soft real-time system:

More information

Real-time Support in Operating Systems

Real-time Support in Operating Systems Real-time Support in Operating Systems Colin Perkins teaching/2003-2004/rtes4/lecture11.pdf Lecture Outline Overview of the rest of the module Real-time support in operating systems Overview of concepts

More information

Practice Exercises 305

Practice Exercises 305 Practice Exercises 305 The FCFS algorithm is nonpreemptive; the RR algorithm is preemptive. The SJF and priority algorithms may be either preemptive or nonpreemptive. Multilevel queue algorithms allow

More information

CPU Scheduling: Objectives

CPU Scheduling: Objectives CPU Scheduling: Objectives CPU scheduling, the basis for multiprogrammed operating systems CPU-scheduling algorithms Evaluation criteria for selecting a CPU-scheduling algorithm for a particular system

More information