Cyber-Physical Systems Scheduling

Similar documents
Processes. Criteria for Comparing Scheduling Algorithms

Final Review. Chenyang Lu. CSE 467S Embedded Compu5ng Systems

CS 5523: Operating Systems

Operating Systems. Chenyang Lu

Real-Time Scheduling Single Processor. Chenyang Lu

CS 5523 Operating Systems: Synchronization in Distributed Systems

Quality of Service in Optical Telecommunication Networks

Real-Time CORBA. Chenyang Lu CSE 520S

File Systems: Fundamentals

Adaptive QoS Control for Real-Time Systems

Concurrent Programing: Why you should care, deeply. Don Porter Portions courtesy Emmett Witchel

HPCG on Tianhe2. Yutong Lu 1,Chao Yang 2, Yunfei Du 1

Report No. UCB/CSD November Computer Science Division (EECS) University of California. Berkeley, California 94720

A Micro-Benchmark Evaluation of Catamount and Cray Linux Environment (CLE) Performance

Batch binary Edwards. D. J. Bernstein University of Illinois at Chicago NSF ITR

Critiques. Ø Critique #1

A procedure to compute a probabilistic bound for the maximum tardiness using stochastic simulation

Cyber-Physical Systems Feedback Control

CS 2461: Computer Architecture I

Civil Justice Improvements (CJI) Committee. Update #2

CSE 520S Real-Time Systems

Exploring QR Factorization on GPU for Quantum Monte Carlo Simulation

CS 4407 Algorithms Greedy Algorithms and Minimum Spanning Trees

TinyOS and nesc. Ø TinyOS: OS for wireless sensor networks. Ø nesc: programming language for TinyOS.

Effect of Voting Machine Shortages in Franklin County, Ohio General Election

General Framework of Electronic Voting and Implementation thereof at National Elections in Estonia

SMS based Voting System

CS 5523 Operating Systems: Intro to Distributed Systems

Coalitional Game Theory

Performance & Energy

Title: Solving Problems by Searching AIMA: Chapter 3 (Sections 3.1, 3.2 and 3.3)

Introduction. Standard Processes Manual VERSION 3.0: Effective: June 26,

Servilla: Service Provisioning in Wireless Sensor Networks. Chenyang Lu

Evaluation of an Appropriate Model for a SADC Customs Union Policy Brief

Discourse Obligations in Dialogue Processing. Traum and Allen Anubha Kothari Meaning Machines, 10/13/04. Main Question

Report for the Associated Press: Illinois and Georgia Election Studies in November 2014

2017 Municipal Election Review

COULD SIMULATION OPTIMIZATION HAVE PREVENTED 2012 CENTRAL FLORIDA ELECTION LINES?

Learning Systems. Research at the Intersection of Machine Learning & Data Systems. Joseph E. Gonzalez

A Calculus for End-to-end Statistical Service Guarantees

Consistency in Daily Travel Time An Empirical Assessment from Sydney Travel Surveys

Facebook Guide for State Legislators

Estimating the Margin of Victory for Instant-Runoff Voting

Strengthen Stewardship With Electronic Giving

Stanford, California Sunday, January 16, 2011

Last Time. Bit banged SPI I2C LIN Ethernet. u Embedded networks. Ø Characteristics Ø Requirements Ø Simple embedded LANs

Case 1:18-cv TWP-MPB Document 1 Filed 01/04/18 Page 1 of 17 PageID #: 1

Vote for Best Candy...

Liveness: The Readers / Writers Problem

Deadlock. deadlock analysis - primitive processes, parallel composition, avoidance

CODES AND STANDARDS COMMITTEE OPERATING PROCEDURES

Internet of Things Wireless Sensor Networks. Chenyang Lu

Estimating the Margin of Victory for an IRV Election Part 1 by David Cary November 6, 2010

STEM Discovery: New York and Boston 6 days Led by: Denise Cranford & Tracy Critch

Planning (Scotland) Bill [AS INTRODUCED]

LAW ON AMENDING AND SUPPLEMENTING THE LAW NO. 03/L-223 ON THE KOSOVO. Based on Article 65 (1) of the Constitution of the Republic of Kosovo, Article 1

Wind power integration and consumer behavior: a complementarity approach

Benefits of a Modern Court Case Management System by Richard Slowes, Former Commissioner of Minnesota Supreme Court WHITE PAPER

Uninformed search. Lirong Xia

Board Chairman's Guide

vi. COMPETITIVE FEDERALISM National, state and local governments are in competition with each other to deliver packages of services and taxes. vii.

Measurement and Summary Statistics Practice

Philips Lifeline. Ø Chenyang Lu 1

YOOCHOOSE GmbH Terms and Conditions Subject Matter

Optimization Strategies

Recommendations For Reddit Users Avideh Taalimanesh and Mohammad Aleagha Stanford University, December 2012

Commentary on the Land and Environment Court of New South Wales. Introduction

Guided Study Program in System Dynamics System Dynamics in Education Project System Dynamics Group MIT Sloan School of Management 1

Downloaded from: justpaste.it/vlxf

bulletin 139 Youth justice in Australia Summary Bulletin 139 MArch 2017

Delivery and Payment Conditions of (valid from 01 January 2012) Salzgitter Bauelemente GmbH

Choosing the Right Monitor for Your Application

Implementing Domain Specific Languages using Dependent Types and Partial Evaluation

COUNCIL PROCEDURE BYLAW 2183, 2014

The March 2017 Northern Ireland Assembly election

(2) (Company Number ) whose correspondence address is at

PPIC Statewide Survey Methodology

Civil Society Organizations in Montenegro

10 th SPC Heads of Fisheries Meeting

Supreme Court of Florida

ABC systems in Europe and beyond - status and recommendations for the way forward

A New Method of the Single Transferable Vote and its Axiomatic Justification

Google App Engine 8/10/17. CS Cloud Compu5ng Systems--Summer II 2017

Real-Time Wireless Control Networks for Cyber-Physical Systems

DEPARTMENT OF HOMELAND SECURITY. U.S. Customs and Border Protection. 8 CFR Parts 103 and 235. Docket No. USCBP CBP Decision No.

UNHCR Policy on Refugees in Urban Areas

VUSUMUZI MKHIZE 16 January 2017

Maryland State Board of Elections Comprehensive Audit Guidelines Revised: February 2018

STRICT LIABILITY. (1) involves serious potential harm to persons or property,

Digital research data in the Sigma2 prospective

RULES OF THE HOUSE OF DELEGATES

FastPass and EasyPASS ABC from science to solution

SUMMARY LABOUR MARKET CONDITIONS POPULATION AND LABOUR FORCE. UNRWA PO Box Sheikh Jarrah East Jerusalem

Domestic Structure, Economic Growth, and Russian Foreign Policy

ASSAM ELECTRICITY REGULATORY COMMISSION (DEVIATION SETTLEMENT MECHANISM AND RELATED MATTERS) REGULATIONS, 2018 NOTIFICATION

The Digital Appellate Court Introduction to the edca Electronic Portal

Support Vector Machines

Comparison Sorts. EECS 2011 Prof. J. Elder - 1 -

Assumption of TOBT Responsibility and Usage Agreement HAM CSA

Agenda Administration Conference Room Tuesday, November 20, :00 p.m.

Transcription:

Cyber-Physical Systems Scheduling ICEN 553/453 Fall 2018 Prof. Dola Saha 1

Quick Recap 1. What characterizes the memory architecture of a system? 2. What are the issues with heaps in embedded/real-time systems? 3. How do polling and interrupts compare? 4. What is the difference between concurrency and parallelism? 5. What are threads? What makes them challenging wrt. concurrency? 2

Scheduler Ø A scheduler makes the decision about what to do next at certain points in time Ø When a processor becomes available, which process will be executed 3

Scheduler Policy Ø Different schedulers will have different goals Maximize throughput Minimize latency Prevent indefinite postponement Complete process by given deadline Maximize processor utilization 4

Scheduler Levels Ø High-level scheduling Determines which jobs can compete for resources Controls number of processes in system at one time Ø Intermediate-level scheduling Determines which processes can compete for processors Responds to fluctuations in system load Ø Low-level scheduling Assigns priorities Assigns processors to processes 5

Priorities Ø Static priorities Priority assigned to a process does not change Easy to implement Low overhead Not responsive to changes in environment Ø Dynamic priorities Responsive to change Promote smooth interactivity Incur more overhead, justified by increased responsiveness 6

How to decide which thread to schedule? ØConsiderations: Preemptive vs. non-preemptive scheduling Periodic vs. aperiodic tasks Fixed priority vs. dynamic priority Priority inversion anomalies Other scheduling anomalies 7

Non-Preemptive vs Preemptive Ø Non-Preemptive Once a process is in the running state, it will continue until it terminates or blocks itself for I/O Ø Preemptive Currently running process may be interrupted and moved to ready state by the OS Decision to preempt may be performed o when a new process arrives, o when an interrupt occurs that places a blocked process in the Ready state, or o periodically, based on a clock interrupt 8

Preemptive Scheduling Ø Assume all threads have priorities either statically assigned (constant for the duration of the thread) or dynamically assigned (can vary). Ø Assume that the kernel keeps track of which threads are enabled Ø Preemptive scheduling: At any instant, the enabled thread with the highest priority is executing. Whenever any thread changes priority or enabled status, the kernel can dispatch a new thread. 9

Periodic scheduling T 1 T 2 Ø Each execution instance of a task is called a job. Ø For periodic scheduling, the best that we can do is to design an algorithm which will always find a schedule if one exists. Ø A scheduler is defined to be optimal iff it will find a schedule if one exists. 10

Scheduling Policies Ø First Come First Serve Ø Round Robin Ø Shortest Process Next Ø Shortest Remaining Time Next Ø Highest Response Ratio Next Ø Feedback Scheduler Ø Fair Share Scheduler 11

First Come First Serve (FCFS) Ø Processes dispatched according to arrival time Ø Simplest scheme Ø Nonpreemptible Ø Rarely used as primary scheduling algorithm Ø Implemented using FIFO Ø Tends to favor processor-bound processes over I/O-bound processes 12

Round Robin Ø Based on FIFO Ø Processes run only for a limited amount of time called a time slice or a quantum Ø Preemptible Ø Requires the system to maintain several processes in memory to minimize overhead Ø Often used as part of more complex algorithms 13

Effect of Quantum Size Time Process allocated time quantum Interaction complete Process allocated time quantum Process preempted Process allocated time quantum Interaction complete Response time s Quantum q q - s q Other processes run s q < Typical Interaction Time q > Typical Interaction Time 14

Quantum Size Ø Determines response time to interactive requests Ø Very large quantum size Processes run for long periods Degenerates to FIFO Ø Very small quantum size System spends more time context switching than running processes Ø Middle-ground Long enough for interactive processes to issue I/O request Batch processes still get majority of processor time 15

Virtual Round Robin Time-out Ø FCFS auxiliary queue to which processes are moved after being released from an I/O block. Ø When a dispatching decision is to be made, processes in the auxiliary queue get preference over those in the main ready queue. Admit I/O 1 Occurs I/O 2 Occurs I/O n Occurs Ready Queue Auxiliary Queue I/O 1 Queue I/O 2 Queue I/O n Queue Dispatch Processor I/O 1 Wait I/O 2 Wait I/O n Wait Release 16

Virtual Round Robin Time-out Ø When a process is dispatched from the auxiliary queue, it runs no longer than a time equal to the basic time quantum minus the total time spent running since it was last selected from the main ready queue. Admit I/O 1 Occurs Ready Queue Auxiliary Queue I/O 1 Queue Dispatch Processor I/O 1 Wait Release Ø Performance studies indicate that this approach is better than round robin in terms of fairness. I/O 2 Occurs I/O 2 Queue I/O 2 Wait I/O n Occurs I/O n Queue I/O n Wait 17

Shortest Process Next (SPN) Scheduling Ø Scheduler selects process with smallest time to finish Lower average wait time than FIFO o Reduces the number of waiting processes Potentially large variance in wait times, starvation for longer processes Nonpreemptive o Results in slow response times to arriving interactive requests Relies on estimates of time-to-completion o Can be inaccurate Unsuitable for use in modern interactive systems 18

Shortest Remaining Time (SRT) Scheduling Ø Preemptive version of SPF Ø Shorter arriving processes preempt a running process Ø Very large variance of response times: long processes wait even longer than under SPF Ø Not always optimal Short incoming process can preempt a running process that is near completion Context-switching overhead can become significant 19

Highest Response Ratio Next (HRRN) Scheduling Ø Chooses next process with the greatest ratio Ø Attractive because it accounts for the age of the process Ø While shorter jobs are favored, aging without service increases the ratio so that a longer process will eventually get past competing shorter jobs 20

Feedback Scheduling Ø Ø Scheduling is done on a preemptive (at time quantum) basis, and a dynamic priority mechanism is used. When a process first enters the system, it is placed in RQ0. Admit RQ0 Processor Release Ø After its first preemption, when it returns to the Ready state, it is placed in RQ1. RQ1 Processor Release Ø Each subsequent time that it is preempted, it is demoted to the next lower-priority queue. RQn Processor Release 21

Performance Ø Any scheduling policy that chooses the next item to be served independent of service time obeys the relationship: 22

Single Server Queue with Two Priorities 23

Single Server Queue with Two Priorities 24

Fair Share Scheduler Scheduling decisions based on the process sets Each user is assigned a share of the processor Objective is to monitor usage to give fewer resources to users who have had more than their fair share and more to those who have had less than their fair share Some user groups more important than others Ensures that less important groups cannot monopolize resources Unused resources distributed according to the proportion of resources each group has been allocated Groups not meeting resource-utilization goals get higher priority 25

Fair Share CPU j (i) = 2 CPU j (i 1) GCPU k (i) = 2 GCPU k (i - 1) CPU j (i) GCPU k (i) P j (i) = Base j + 2 + 4 x W k where CPU j (i) = measure of processor utilization by process j through interval i, GCPU k (i) = measure of processor utilization of group k through interval i, P j (i) Base j W k = priority of process j at beginning of interval i; lower values equal higher priorities, = base priority of process j, and = weighting assigned to group k, with the constraint that and 0 < W k < 1 and W k = 1. 26

Example Time 0 1 2 3 4 5 Process A Process Group CPU CPU Priority 60 count 0 1 2 60 count 0 1 2 60 90 30 30 74 15 16 17 75 78 18 19 20 78 15 16 17 75 96 37 37 18 19 20 78 Process B Process Group CPU CPU Priority count count 60 0 0 60 0 1 2 60 0 1 2 60 90 30 30 74 15 15 16 17 75 Process C Process Group CPU CPU Priority count count 60 0 0 60 0 0 1 2 60 75 0 30 67 0 1 2 60 98 39 39 70 3 18 76 15 18 15 16 17 75 81 7 37 93 30 37 Group 1 Group 2 27

UNIX Scheduler Ø Designed to provide good response time for interactive users while ensuring that low-priority background jobs do not starve Ø Employs multilevel feedback using round robin within each of the priority queues Ø Makes use of one-second preemption Ø Priority is based on process type and execution history 28

Scheduling Formula 29

Characteristics of Various Scheduling Policies 30