RTOS Scheduling – II EE202A (Fall 2001): Lecture #5.

Slides:



Advertisements
Similar presentations
QoS-based Management of Multiple Shared Resources in Dynamic Real-Time Systems Klaus Ecker, Frank Drews School of EECS, Ohio University, Athens, OH {ecker,
Advertisements

LOTTERY SCHEDULING: FLEXIBLE PROPORTIONAL-SHARE RESOURCE MANAGEMENT
Embedded System Lab. 1 Embedded system Lab.
Mani Srivastava UCLA - EE Department Room: 6731-H Boelter Hall Tel: WWW: Copyright 2003.
1 EE5900 Advanced Embedded System For Smart Infrastructure RMS and EDF Scheduling.
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
CS5270 Lecture 31 Uppaal, and Scheduling, and Resource Access Protocols CS 5270 Lecture 3.
Courseware Scheduling of Distributed Real-Time Systems Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens.
An Approximate Truthful Mechanism for Combinatorial Auctions An Internet Mathematics paper by Aaron Archer, Christos Papadimitriou, Kunal Talwar and Éva.
Online Scheduling with Known Arrival Times Nicholas G Hall (Ohio State University) Marc E Posner (Ohio State University) Chris N Potts (University of Southampton)
RUN: Optimal Multiprocessor Real-Time Scheduling via Reduction to Uniprocessor Paul Regnier † George Lima † Ernesto Massa † Greg Levin ‡ Scott Brandt ‡
Task Allocation and Scheduling n Problem: How to assign tasks to processors and to schedule them in such a way that deadlines are met n Our initial focus:
Module 2 Priority Driven Scheduling of Periodic Task
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Soft Real-Time Semi-Partitioned Scheduling with Restricted Migrations on Uniform Heterogeneous Multiprocessors Kecheng Yang James H. Anderson Dept. of.
Chapter 9 Uniprocessor Scheduling Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008,
Towards Feasibility Region Calculus: An End-to-end Schedulability Analysis of Real- Time Multistage Execution William Hawkins and Tarek Abdelzaher Presented.
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
G Robert Grimm New York University Lottery Scheduling.
Scheduling for Embedded Real-Time Systems Amit Mahajan and Haibo.
Scheduling in Batch Systems
Project 2 – solution code
Cs238 CPU Scheduling Dr. Alan R. Davis. CPU Scheduling The objective of multiprogramming is to have some process running at all times, to maximize CPU.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
Distributed Real-Time systems 1 By: Mahdi Sadeghizadeh Website: Sadeghizadeh.ir Advanced Computer Networks.
More Scheduling cs550 Operating Systems David Monismith.
Lottery Scheduling: Flexible Proportional-Share Resource Management Sim YounSeok C. A. Waldspurger and W. E. Weihl.
Memory Management Chapter 7.
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.
1 Scheduling Processes. 2 Processes Each process has state, that includes its text and data, procedure call stack, etc. This state resides in memory.
Quality of Service Karrie Karahalios Spring 2007.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Scheduling policies for real- time embedded systems.
Prepare by : Ihab shahtout.  Overview  To give an overview of fixed priority schedule  Scheduling and Fixed Priority Scheduling.
2.5 Scheduling Given a multiprogramming system. Given a multiprogramming system. Many times when more than 1 process is waiting for the CPU (in the ready.
CompSci 143A1 5. Process and thread scheduling 5.1 Organization of Schedulers – Embedded and Autonomous Schedulers – Priority Scheduling 5.2 Scheduling.
Special Class on Real-Time Systems
CSE 522 Real-Time Scheduling (2)
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
2.5 Scheduling. Given a multiprogramming system, there are many times when more than 1 process is waiting for the CPU (in the ready queue). Given a multiprogramming.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Introduction to Real-Time Systems
CS333 Intro to Operating Systems Jonathan Walpole.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
Determining Optimal Processor Speeds for Periodic Real-Time Tasks with Different Power Characteristics H. Aydın, R. Melhem, D. Mossé, P.M. Alvarez University.
Unit - I Real Time Operating System. Content : Operating System Concepts Real-Time Tasks Real-Time Systems Types of Real-Time Tasks Real-Time Operating.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
Lecture 6: Real-Time Scheduling
Distributed Process Scheduling- Real Time Scheduling Csc8320(Fall 2013)
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.
Embedded System Scheduling
Advanced Operating Systems (CS 202) Scheduling (2)
Wayne Wolf Dept. of EE Princeton University
EEE 6494 Embedded Systems Design
Chapter 8 – Processor Scheduling
Lecture 4 Schedulability and Tasks
Lottery Scheduling: Flexible Proportional-Share Resource Management
Lottery Scheduling Ish Baid.
Elastic Task Model For Adaptive Rate Control
CSCI1600: Embedded and Real Time Software
CPU scheduling decisions may take place when a process:
CSCI1600: Embedded and Real Time Software
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Parallel Programming in C with MPI and OpenMP
The End Of The Line For Static Cyclic Scheduling?
Ch 4. Periodic Task Scheduling
Presentation transcript:

RTOS Scheduling – II EE202A (Fall 2001): Lecture #5

Reading List for This Lecture Required Waldspurger, C.A.; Weihl, W.E. Lottery scheduling: flexible proportional-share resource management. Proceedings of the First USENIX Symposium on Operating Systems Design and Implementation (OSDI), Monterey, CA, USA, 14-17 Nov. 1994. p.1-11. 280 pp. Recommended none Others

Deadline Driven Scheduling Priorities are assigned to tasks according to the deadlines of their current requests highest priority to task whose current request has the closest deadline lowest to the one whose deadline is the furthest highest priority task with an unfulfilled request is run Priorities of tasks change with time!

Preemptive Earliest Deadline First (EDF) Processor executes the task whose absolute deadline is the earliest Priorities change with the closeness of a task to its absolute deadline Example: Task Arrival Time Execution Time Absolute Deadline T1 10 30 T2 4 3 T3 5 25

EDF Schedulability Optimal for single processor If EDF cannot schedule a task set on a single processor, then no other scheduling algorithm can Simple schedulability test if tasks are periodic, and have relative deadlines equal to their periods if the total utilization U of the task set is no greater than 1, the task set can be feasibly scheduled by EDF on a single processor. If relative deadlines are not equal to the periods, there is no simple schedulability test one will have top develop a schedule using EDF to see whether all the deadlines are met over a given time interval

EDF Schedulability for Deadline==Period Case Theorem: Suppose we have a set of n periodic tasks (Ti, Ci, Di) , each of whose relative deadline Di equals its period Ti. The tasks can be feasibly scheduled by EDF on a single processor iff: C1/T1 + C2/T2 + … + Cn/Tn  1

EDF Schedulability for Deadline!=Period Case Theorem: A set t of n tasks (Ti, Ci, Di) is not schedulable by EDF iff Utilization U > 1, or there exists t < min { T + Dmax, U/(1-U) * max1 in{Ti – Di}} such that ht(t) > t, where Dmax = max1 in{Di} T = lcm(T1,…Tn) ht (t) = sum of the execution times of all tasks whose absolute deadlines are ≤ t. With the above theorem, we only need to check for feasibility up to some finite time. Proof see Theorem 3.1.2 + related Lemmas at http://nesl.ee.ucla.edu/pw/ee202a/edf.pdf Note the difference in notation (T, C, D) → (P, e, d)

Allowing for Precedence Constraints So far: independent task, preemptible by others Now we relax these condition

Heuristic for Uniprocessor Scheduling

Heuristic for Uniprocessor Scheduling (contd.) Schedule after step 2 Schedule after step 3

Primary and Alternative Tasks So far: there must be sufficient time for the critical tasks to execute assumed worst case execution time (WCET) quite often WCET >> mean execution time One way: reclaim unused time for other tasks Another approach: multiple versions of tasks Precise version Alternate version shorter processing time but imprecise result just acceptable “bare bones” result

Example Can’t schedule if only primary version available

Imprecise or Approximate Computation A time-critical task designed in such a way that an approximate result is produced when the entire precise computation cannot be completed Motivation: tasks become easier to schedule when a tolerable amount of error can be introduced into the system Examples: Iterative division algorithm On-line arithmetic Bit-serial where the output is produced MSB first

Scheduling Model for Imprecise Computation IRIS: Increased Reward for Increased Service Each Task, Ti, is decomposed logically into two tasks Mi (mandatory) and Oi (optional) i = mi + oi (12 = 7 + 5) Classical model => oi = 0

Uniprocessor Scheduling of IRIS Tasks Reward function Schedule the tasks such that the reward is maximized, subject to the requirement that the mandatory portions of all the tasks are complete

QoS-based Resource Allocation Model (Q-RAM) Different total system utility by resource allocations (Rajkumar et al. 1997, 1998)

RM in Distributed/Networked Embedded Systems? Task is essentially scheduled on multiple resources in series Need to schedule communication messages over the interconnect propagation delay & jitter queuing delay & jitter Divide end-to-end deadline into subsystem deadlines Need buffering to mitigate jitter problem as task may arrive too early

Assignment of Tasks to Processors NP complete in most cases Typical heuristics: Allocate tasks according to some simple criterion E.g. processor utlization Check feasibility Communiction cost, task precedences If not feasible, modify the allocation and retry

Utilization-Balancing Algorithm Attempts to balance processor utilization Allocate tasks one by one, and selecting the least utilized processor Takes into account the possibility of running multiple copies of the same task for fault tolerance

Next-Fit Algorithm for RM User defines M>3 classes as follows: Task Ti is in class j<M if In class M otherwise Corresponding to each class is a set of processors that is only allocated tasks of that class Tasks are allocated one by one to appropriate processor class until all the tasks have been scheduled, adding processors to classes if that is need for RM schedulability

Example Uses no more than N times the minimum # of processors

Bin-packing Algorithm for EDF Periodic independent preemptible tasks assigned to a multiprocessor with identical processors Goal EDF schedulability assign tasks such that U no greater than 1 First-fir decreasing algorithm

Example

Distributed Case with Data Precedence Implicit start and stop nodes in each task Rate constraint and deadline for each task Period may not be constant: lower/upper bounds Execution time of processes may not be constant Lower/upper bounds

Performance Analysis The problem of deciding whether the deadline of each task is met is NP hard Given the schedule, allocation, and architecture Unrolling the schedule doesn’t work Cannot easily handle non-constant period and computation times Can’t just use the worst case execution time!

Erroneous Results in Using WCET in Unrolled Schedules

Erroneous Results in Using WCET in Unrolled Schedules

Lottery Scheduling: Flexible Proportional-Share Resource Management 4/17/2017 Lottery Scheduling: Flexible Proportional-Share Resource Management A randomized mechanism that provides responsive control over the relative execution rates of computations Does away with “primitive” priority based schemes Implements proportional-share resource management whereby the resource consumption rates are proportional to the relative shares that they are allocated “Found to provide efficient, flexible control over relative execution rates”

Allocation of Resource Rights 4/17/2017 Allocation of Resource Rights Resource allocation determined by holding a lottery This effectively allocates resources to competing clients in proportion to the number of tickets that they hold

Lottery Scheduling by lottery is probabilistically fair 4/17/2017 Lottery Scheduling by lottery is probabilistically fair Number of lotteries won by a client has a binomial distribution P = t/T E[w] = np s2w = np(1-p) Number of lotteries required for a client’s first win has a geometric distribution E[n] = 1/p s2w = (1-p)/p2 Typical scheduling quantum is 10 ms (100 lotteries per second)

Lottery Tickets Properties 4/17/2017 Lottery Tickets Properties Abstract Relative Uniform Analogous to that of money in computational economics Abstractly encapsulate resource rights Allow for modular resource management

Modular Resource Management 4/17/2017 Modular Resource Management Ticket transfers Explicit transfers of tickets from one client to another Can be used in any situation where a client blocks due to some dependency Solves conventional priority inversion problem in a manner similar to priority inheritance Ticket inflation Alternative to explicit ticket transfers Escalate resource rights by creating more lottery tickets Need for mutual trust among clients Inflation and deflation can be used to adjust resource allocations w/o explicit communication

Modular Resource Management (cont’d) 4/17/2017 Modular Resource Management (cont’d) Ticket currencies Resources rights could be expressed in “local” units, with granularity tuned for that particular resource Each currency is backed, or funded, by tickets that are denominated in more primitive currencies Exchange rates could be established between local currency and base currency Compensation Tickets Compensation ticket granted for client only consuming only a fraction f of its allocated resource quantum, inflate its value by 1/f Ex: Threads A and B each hold tickets valued at 400 base units (1:1 ratio) Thread A always consumes its entire 100 ms of quantum Thread B uses only 20 ms => f = 1/5

Implementation alice Ticket Currency 4/17/2017 Implementation Modified Mach 3.0 microkernel running on a 25MHz MIPS-based DECStation 5000/125 Kernel representation of tickets and currencies List of backing tickets amount 1000 Base currency alice Unique name Active amount 300 List of issued tickets Ticket Currency

System Overhead Core lottery scheduling mechanism 4/17/2017 System Overhead Core lottery scheduling mechanism Ex: tree-based lottery need only generate a random number and perform log n additions and comparisons to select winner among n clients Comparing unoptimized kernel to unmodified Mach kernel, it was found that application executed 1.7% faster

Experimental Results Multimedia Applications Load Insulation 4/17/2017 Multimedia Applications 3 MPEG viewers, 3:2:1 allocation ratio Actual ratio, 1.92:1.50:1 No need for cooperation between media-based applications, nor feedback to adjust frame rates Load Insulation Two tasks A and B w/ equal funding Subtasks A1 and A2 have allocations of 100 and 200, respectively Subtasks B1 and B2 have identical allocations Currency has an abstract barrier that locally contains intra-currency fluctuations System was found to be fair, flexible, and robust

4/17/2017 Inverse Lotteries Basic idea: a “loser” is chosen to relinquish a unit of a resource that it holds Instead of obtaining a resource, client tries to prevent having its resource allocation revoked P = 1/(n-1)*(1-t/T)

4/17/2017 Multiple Resources Clients can make quantitative comparisons to make decisions involving tradeoffs between different resources Questions Funding policies? Frequency of fund allocation evaluation?

4/17/2017 “Financial Advisor” Abstract the evaluation of resource management options Financial manager would be allocated a fixed small percentage (e.g. 1%) of application’s overall funding (or computation time) Default simple managers for most applications, complex management strategies for sophisticated applications

Lottery Scheduling Summary 4/17/2017 Lottery Scheduling Summary Lottery scheduling is conceptually very simple and easily implemented Used to manage any resource where management is necessary to resolve multiple requests Current ongoing work involves exploring various applications of lottery scheduling in interactive systems, including GUI element