Quality of Service su Linux: Passato Presente e Futuro



Similar documents
Using EDF in Linux: SCHED DEADLINE. Luca Abeni

Hard Real-Time Linux

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

Realtime Linux Kernel Features

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Lecture 3 Theoretical Foundations of RTOS

Aperiodic Task Scheduling

Real-Time Scheduling and Threads: Basics

Real-Time Scheduling (Part 1) (Working Draft) Real-Time System Example

Improvement of Scheduling Granularity for Deadline Scheduler

Predictable response times in event-driven real-time systems

Real- Time Mul,- Core Virtual Machine Scheduling in Xen

Enhancing the Monitoring of Real-Time Performance in Linux

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

Operating Systems. III. Scheduling.

Chapter 19: Real-Time Systems. Overview of Real-Time Systems. Objectives. System Characteristics. Features of Real-Time Systems

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

Operating System Aspects. Real-Time Systems. Resource Management Tasks

Tasks Schedule Analysis in RTAI/Linux-GPL

Real Time Scheduling Basic Concepts. Radek Pelánek

Processes and Non-Preemptive Scheduling. Otto J. Anshus

REAL TIME OPERATING SYSTEMS. Lesson-10:

4. Fixed-Priority Scheduling

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

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

Linux Plumbers API for Real-Time Scheduling with Temporal Isolation on Linux

Real-time Operating Systems. VO Embedded Systems Engineering Armin Wasicek

Real-time KVM from the ground up

Aperiodic Task Scheduling

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

Comparison between scheduling algorithms in RTLinux and VxWorks

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

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

Performance Comparison of RTOS

Processor Scheduling. Queues Recall OS maintains various queues

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

Embedded Systems. 6. Real-Time Operating Systems

The Design and Implementation of Real-Time Schedulers in RED-Linux

Resource Reservation & Resource Servers. Problems to solve

Real-Time Scheduling 1 / 39

CPU Scheduling. CPU Scheduling

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Real- Time Scheduling

Real-time Performance Control of Elastic Virtualized Network Functions

Job Scheduling Model

Periodic Task Scheduling

How to Perform Real-Time Processing on the Raspberry Pi. Steven Doran SCALE 13X

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

OPERATING SYSTEMS SCHEDULING

Thread-based analysis of embedded applications with real-time and non real-time processing on a single-processor platform

Real-Time Operating Systems.

Improved Handling of Soft Aperiodic Tasks in Offline Scheduled Real-Time Systems using Total Bandwidth Server

Performance of Host Identity Protocol on Nokia Internet Tablet

ICS Principles of Operating Systems

System Software and TinyAUTOSAR

Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

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

Lecture 6: Interrupts. CSC 469H1F Fall 2006 Angela Demke Brown

CPU Scheduling Outline

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

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

The Bus (PCI and PCI-Express)

Rackspace Cloud Databases and Container-based Virtualization

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

Design and Implementation of a POSIX Compliant Sporadic Server for the Linux Kernel

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

Performance of STAR-System

Asymmetric Scheduling and Load Balancing for Real-Time on Linux SMP

Overview of the Linux Scheduler Framework

Weighted Total Mark. Weighted Exam Mark

Achieving Nanosecond Latency Between Applications with IPC Shared Memory Messaging

Real-Time Multi-Core Virtual Machine Scheduling in Xen

Understanding Linux on z/vm Steal Time

Memory Access Control in Multiprocessor for Real-time Systems with Mixed Criticality

Red Hat Linux Internals

Scheduling Aperiodic and Sporadic Jobs in Priority- Driven Systems

RTAI. Antonio Barbalace (modified by M.Moro 2011) RTAI

What is best for embedded development? Do most embedded projects still need an RTOS?

Operating System: Scheduling

CGL Architecture Specification

Operating Systems Lecture #6: Process Management

CPU Scheduling. Core Definitions

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

Transcription:

Quality of Service su Linux: Passato Presente e Futuro Luca Abeni luca.abeni@unitn.it Università di Trento Quality of Service su Linux:Passato Presente e Futuro p. 1

Quality of Service Time Sensitive applications Implicit temporal constraints: CD Burner Multimedia Streaming client Video Conference Different Time-Sensitive applications can run simultaneously in the same PC A Time-Sensitive application should be able to run on many different systems Temporal constraints must be modelled through QoS metrics Quality of Service su Linux:Passato Presente e Futuro p. 2

QoS of Linux Tasks Problem: how to map QoS parameters on Linux processes/threads? Task τ i : stream of Jobs J i,j Every job J i,j : Arrives at time r i,j (when the task unblocks) Executes for a time c i,j Finishes at time f i,j (when the task blocks) Should finish within a soft deadline d i,j c i,j r i,j f i,j d i,j Quality of Service su Linux:Passato Presente e Futuro p. 3

Need for an EndCycle API Simple mapping between Linux processes/threads and RT tasks / jobs: Task unblocks job arrival Task blocks job termination This works well for scheduling......but is not good for measuring the QoS! For measuring the QoS experienced by a task: The beginning and termination of a job must be explicitly signalled Some kind of endcycle() call is needed to indicate that a job terminates the termination time can be compared with the job deadline Quality of Service su Linux:Passato Presente e Futuro p. 4

Requirements on the OS Kernel Goal: finish each job within its deadline Can be achieved through a proper scheduling Reservation-based scheduling: guarantee a time Q every T to task τ i Scheduling in practice: divergence between theoretical and actual schedule Due to latencies introduced by the system A latency can be modelled as a blocking time......but we want to reduce it to the minimum Quality of Service su Linux:Passato Presente e Futuro p. 5

Kernel Support Scheduler triggered by internal (IPC) or external (IRQ) events Time between the triggering event and dispatch: Event generation Event delivery (example: interrupts may be disabled) Scheduler invocation (non-preemptable sections) Scheduling/Dispatch time Event Time Event Delivery Latency Scheduler Dispatch Commercial RT OSs reduce this latency Quality of Service su Linux:Passato Presente e Futuro p. 6

Resource Reservations Resource Reservations are an effective way for implementing temporal protection Every task is allowed to use a resource for an amount of time Q every period T Two fundamental mechanisms: accounting and enforcement CPU scheduling CPU Reservations (implemented in Resource Kernels) Traditional implementations aperiodic servers Deferrable Server... Quality of Service su Linux:Passato Presente e Futuro p. 7

Broken Temporal Protection Tasks are always backlogged Task 1 is inactive when the reserve is replenished Broken Isolation!!! Quality of Service su Linux:Passato Presente e Futuro p. 8

Our Solution Scheduling Algorithm: Constant Bandwidth Server EDF scheduler tasks are scheduled according to scheduling deadlines Scheduling deadlines are assigned by servers Server: Server Period T s, Maximum Budget Q s Capacity q: decreased when the task executes q = 0 d s = d s + T s On job arrival, check if a new scheduling deadline must be assigned r > d q T s Q s d s = r + T s ;q = Q s otherwise, leave d s and q to current values Can cope with aperiodic arrivals Quality of Service su Linux:Passato Presente e Futuro p. 9

The CBS - An Example CBS with aperiodic arrivals Thanks to the deadline assignment rule, temporal isolation is preserved The CBS is automagically synchronised with periodic tasks Quality of Service su Linux:Passato Presente e Futuro p. 10

Resource Reservations for non RT Tasks Can we use the same reservation algorithm for both real-time and non real-time tasks? The CBS works very well for real-time tasks......but has problems when serving non real-time tasks The Greedy Task problem The Short Period problem τ 1 Q = 1ms 1 T 1= 4ms t1 τ 1 Q T 1 1 τ 2 Q = 3ms 2 T 2= 4ms t2 τ 2 Q = 10.5 Q 2 T = 10.5 T 2 1 1 Quality of Service su Linux:Passato Presente e Futuro p. 11

Solving the two Problems The Greedy Task and Short Period problems are not critical for real-time tasks... For a real-time task the only important thing is to respect a deadline The QoS of a time-sensitive task is not affected if the task finishes earlier than expected...but they affect the performance of non real-time tasks Fairness matters! Solution: HGRUB Reclaiming mechanism (GRUB) Modifies the accounting mechanism Hard reservation behaviour Modifies the enforcement mechanism Quality of Service su Linux:Passato Presente e Futuro p. 12

HGRUB in Action Greedy Task, CBS Greedy Task, Reclaiming Short Period, CBS Short Period, HGRUB Quality of Service su Linux:Passato Presente e Futuro p. 13

Kernel Latencies Linux: monolithic kernel maximum latency L = size of the largest kernel section Traditional non-preemptable kernel: execution in kernel mode cannot be preempted Preemptable kernel: execution in kernel mode can be preempted when no spinlocks are held Timer resolution is not an issue anymore (since kernel 2.6.21) Spinlocks non-preemptable sections Threaded interrupt handlers (and bottom halves) Transform spinlocks in mutexes Priority Inheritance All done in Ingo Molnar s RT patch Quality of Service su Linux:Passato Presente e Futuro p. 14

Kernel Latencies - Some Values Experimental setup: Intel Celeron (@ about 1.2GHz) Periodic RT task (period T ) Background NRT load, stressing the kernel Measure the interactivation time T ; L = T T Non-preemptable kernel: L > 100ms Preemptable Linux: 1ms < L < 10ms RT Patch: L < 40µs Slower processor (AMD K3 @ about 400MHz): about 100µs It is possible to do Hard Real-Time in User Space!!! Quality of Service su Linux:Passato Presente e Futuro p. 15

Scheduling the Device Drivers The CPU is not the only resource needed by RT tasks! There are resource schedulers for Network, Disk, etc... Problem: cooperative-scheduling the resource must be allocated to an application when there is enough CPU time for scheduling the application / the drivers... With the RT patch, interrupt handlers are threads it is possible to schedule them We believe that scheduling device drivers can: Help cooperative-scheduling Account the time spent in interrupt handling Control the interference from device drivers on RT applications Quality of Service su Linux:Passato Presente e Futuro p. 16

Allocating CPU to Interrupt Handlers Which scheduling algorithm / parameters must be used for ISRs and bottom halves? Problem: assign (Q s,t s ) to device drivers... Various possibilities: Client / Server model: compute (Q s,t s ) based on the QoS requested by clients (applications using the driver) Inheritance: when a QoS-aware application uses a driver, the driver s threads inherit the application s reservations Feedback-based approach: use the QoS experienced by applications using the driver to dynamically adjust the driver s reservation Quality of Service su Linux:Passato Presente e Futuro p. 17

esource Reservations vs Fair Scheduling Linux is going to include a fair scheduler (CFS) CFS is already included in the RT patch Sometimes, people do not really want real Resource Reservations Maybe the (Q s,t s ) model is overkilling? (sometimes, people just want give me x% of the CPU ) T s is often seen as an allocation granularity, not related to tasks deadlines......so, maybe the CFS model can be used? (It surely is simpler) What are the mathematical properties of CFS? What s the relation between CFS and CBS / GRUB / HGRUB? Quality of Service su Linux:Passato Presente e Futuro p. 18

Other Co-Scheduling Problems Typical application based on the Client/Server paradigm: the X Server Different scheduling levels: CPU scheduling of the client applications CPU scheduling of the X server Requests scheduling in X Problem: how to assign the proper CPU reservations to X and to the clients, and how to schedule the client requests in X? We developed a tracer for X, and we are implementing reservations in the X scheduler Reserving CPU to X: see IRQ scheduling... Quality of Service su Linux:Passato Presente e Futuro p. 19