CIS 4930/6930: Principles of Cyber-Physical Systems

Similar documents
Embedded Systems 15. REVIEW: Aperiodic scheduling. C i J i 0 a i s i f i d i

Embedded Systems 14. Overview of embedded systems design

Lecture Note #6: More on Task Scheduling EECS 571 Principles of Real-Time Embedded Systems Kang G. Shin EECS Department University of Michigan

Lecture 13. Real-Time Scheduling. Daniel Kästner AbsInt GmbH 2013

Real-Time Systems. Event-Driven Scheduling

Task Models and Scheduling

Aperiodic Task Scheduling

Embedded Systems Development

Real-Time Systems. Event-Driven Scheduling

Networked Embedded Systems WS 2016/17

Real-Time Scheduling and Resource Management

Embedded Systems - FS 2018

Real-time Scheduling of Periodic Tasks (1) Advanced Operating Systems Lecture 2

Real-time operating systems course. 6 Definitions Non real-time scheduling algorithms Real-time scheduling algorithm

Shared resources. Sistemi in tempo reale. Giuseppe Lipari. Scuola Superiore Sant Anna Pisa -Italy

Real-Time and Embedded Systems (M) Lecture 5

Real Time Operating Systems

Real Time Operating Systems

CSE 380 Computer Operating Systems

Process Scheduling for RTS. RTS Scheduling Approach. Cyclic Executive Approach

Dependency Graph Approach for Multiprocessor Real-Time Synchronization. TU Dortmund, Germany

Clock-driven scheduling

Non-Preemptive and Limited Preemptive Scheduling. LS 12, TU Dortmund

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

There are three priority driven approaches that we will look at

Non-preemptive Fixed Priority Scheduling of Hard Real-Time Periodic Tasks

Lecture 6. Real-Time Systems. Dynamic Priority Scheduling

Real-Time Scheduling. Real Time Operating Systems and Middleware. Luca Abeni

Periodic scheduling 05/06/

Real-Time Systems. Lecture 4. Scheduling basics. Task scheduling - basic taxonomy Basic scheduling techniques Static cyclic scheduling

Scheduling Slack Time in Fixed Priority Pre-emptive Systems

Resource Sharing in an Enhanced Rate-Based Execution Model

Real-Time Systems. Lecture #14. Risat Pathan. Department of Computer Science and Engineering Chalmers University of Technology

3. Scheduling issues. Common approaches 3. Common approaches 1. Preemption vs. non preemption. Common approaches 2. Further definitions

EDF Feasibility and Hardware Accelerators

Andrew Morton University of Waterloo Canada

Improved Priority Assignment for the Abort-and-Restart (AR) Model

CPU scheduling. CPU Scheduling

TDDB68 Concurrent programming and operating systems. Lecture: CPU Scheduling II

CPU SCHEDULING RONG ZHENG

Schedulability analysis of global Deadline-Monotonic scheduling

On-line scheduling of periodic tasks in RT OS

Real-Time Scheduling

Scheduling I. Today Introduction to scheduling Classical algorithms. Next Time Advanced topics on scheduling

TDDI04, K. Arvidsson, IDA, Linköpings universitet CPU Scheduling. Overview: CPU Scheduling. [SGG7] Chapter 5. Basic Concepts.

Uniprocessor real-time scheduling

Scheduling. Uwe R. Zimmer & Alistair Rendell The Australian National University

RUN-TIME EFFICIENT FEASIBILITY ANALYSIS OF UNI-PROCESSOR SYSTEMS WITH STATIC PRIORITIES

Optimal Utilization Bounds for the Fixed-priority Scheduling of Periodic Task Systems on Identical Multiprocessors. Sanjoy K.

CSC501 Operating Systems Principles. Deadlock

Rate Monotonic Analysis (RMA)

Multiprocessor Scheduling of Age Constraint Processes

Resource Sharing Protocols for Real-Time Task Graph Systems

Module 5: CPU Scheduling

Scheduling I. Today. Next Time. ! Introduction to scheduling! Classical algorithms. ! Advanced topics on scheduling

Scheduling Periodic Real-Time Tasks on Uniprocessor Systems. LS 12, TU Dortmund

Real-Time Systems. LS 12, TU Dortmund

Priority-driven Scheduling of Periodic Tasks (1) Advanced Operating Systems (M) Lecture 4

Real-time Scheduling of Periodic Tasks (2) Advanced Operating Systems Lecture 3

Chapter 6: CPU Scheduling

Schedulability Analysis for the Abort-and-Restart Model

Real-time Systems: Scheduling Periodic Tasks

Operating Systems. VII. Synchronization

Bounding the End-to-End Response Times of Tasks in a Distributed. Real-Time System Using the Direct Synchronization Protocol.

Process Scheduling. Process Scheduling. CPU and I/O Bursts. CPU - I/O Burst Cycle. Variations in Bursts. Histogram of CPU Burst Times

Scheduling Lecture 1: Scheduling on One Machine

A Theory of Rate-Based Execution. A Theory of Rate-Based Execution

The FMLP + : An Asymptotically Optimal Real-Time Locking Protocol for Suspension-Aware Analysis

Lec. 7: Real-Time Scheduling

Selected solutions for. TDDD07 Real-time Systems

CHAPTER 5 - PROCESS SCHEDULING

Real-time scheduling of sporadic task systems when the number of distinct task types is small

Exam Spring Embedded Systems. Prof. L. Thiele

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

Deadline-driven scheduling

Rate-monotonic scheduling on uniform multiprocessors

An Improved Schedulability Test for Uniprocessor. Periodic Task Systems

Simple Dispatch Rules

LSN 15 Processor Scheduling

EECS 571 Principles of Real-Time Embedded Systems. Lecture Note #7: More on Uniprocessor Scheduling

On the Soft Real-Time Optimality of Global EDF on Multiprocessors: From Identical to Uniform Heterogeneous

Task Reweighting under Global Scheduling on Multiprocessors

CEC 450 Real-Time Systems

Scheduling Lecture 1: Scheduling on One Machine

Scheduling Algorithms for Multiprogramming in a Hard Realtime Environment

Non-Work-Conserving Non-Preemptive Scheduling: Motivations, Challenges, and Potential Solutions

CPU Scheduling. CPU Scheduler

Static priority scheduling

Global Real-Time Semaphore Protocols: A Survey, Unified Analysis, and Comparison

Design of Real-Time Software

EDF Scheduling. Giuseppe Lipari May 11, Scuola Superiore Sant Anna Pisa

Last class: Today: Threads. CPU Scheduling

Tardiness Bounds under Global EDF Scheduling on a Multiprocessor

Exploiting Precedence Relations in the Schedulability Analysis of Distributed Real-Time Systems

CEC 450 Real-Time Systems

EDF and RM Multiprocessor Scheduling Algorithms: Survey and Performance Evaluation

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

Load Regulating Algorithm for Static-Priority Task Scheduling on Multiprocessors

A Dynamic Real-time Scheduling Algorithm for Reduced Energy Consumption

Paper Presentation. Amo Guangmo Tong. University of Taxes at Dallas January 24, 2014

Transcription:

CIS 4930/6930: Principles of Cyber-Physical Systems Chapter 11 Scheduling Hao Zheng Department of Computer Science and Engineering University of South Florida H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 1 / 44

Functions of an Operating System (or Microkernel) Memory management File system Networking Security Input and output (interrupt handling) Synchronization (semaphores and locks) Scheduling of threads or processes H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 2 / 44

Functions of an Operating System (or Microkernel) Memory management File system Networking Security Input and output (interrupt handling) Synchronization (semaphores and locks) Scheduling of threads or processes Creation and termination of threads Timing of thread activations H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 2 / 44

Real-time Systems A real-time system includes timing constraints such as: Physical-time deadlines by which a task must be completed. Requirements that a task must occur no earlier than a particular time. A task must occur a set time after another task. A task must occur periodically at some specified period. Tasks may be dependent on one another or simply share a processor. All of these cases require a careful scheduling strategy. k 6 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 3 / 44

11.1 Basics of Scheduling: 11.1.1 Scheduling Decisions A scheduling decision has three parts: Assignment: which processor should execute the task. Ordering: in what order each processor should execute its tasks. Timing: the time at which each task executes. Decisions may be at design time or run time. A fully-static scheduler makes all decisions at design time (no locks). A static order scheduler defers timing to run time (may block on lock). A static assignment scheduler defers ordering and timing to run time. A fully-dynamic scheduler makes all decisions at run time. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 4 / 44

11.1 Basics of Scheduling: 11.1.1 Scheduling Decisions A non-preemptive scheduler dispatches when current thread completes. A preemptive scheduler may make a scheduling decision during execution of a task Upon a timer interrupt at a jiffy interval. Upon an I/O interrupt. When it attempts to acquire an unavailable lock, and resumed when another task releases the lock. When it releases a lock, if a higher priority thread requires the lock. When the current thread makes any OS call. File system access Network access... H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 5 / 44

11.1.2 Task Models The set of assumptions is called the task model of the scheduler. Assume a finite number of tasks that may or may not terminate. Real-time systems often assume that tasks terminate. Some schedulers can assume that All tasks are known before scheduling begins, or New tasks can arrive dynamically. Some schedulers support scenarios where each task τ T executes repeatedly, possibly forever, and possibly periodically. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 6 / 44

11.1.2 Task Models Distinction between a task and its executions: When task τ T executes repeatedly, the task executions are τ 1, τ 2,.... A sporadic task repeats with irregular timing, but has a lower bound on the time between executions. If execution i must precede j, we write i < j (precedence constraint). A task may require preconditions to be satisfied before it is enabled. Availability of a lock may be a precondition for resumption of a task. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 7 / 44

Task Execution Times i o i e i r i s i f i d i H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 8 / 44

Deadlines and Priority Hard real-time scheduling has hard deadlines which are real physical constraints that are an error when missed. Soft real-time scheduling has desired deadlines which are not errors when missed. A priority-based scheduler assumes each task is assigned a number (priority) and chooses the enabled task with the highest priority. A fixed priority remains constant while a dynamic priority can change. A non-preemptive priority-based scheduler only uses the priorities to choose the next task, but never interrupts a task that is executing. A preemptive priority-based scheduler can change to a higher priority task at any time. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 9 / 44

11.1.3 Comparing Schedulers A schedule is feasible if it meets all deadlines (f i d i ). A scheduler that produces feasible schedules whenever possible is optimal with respect to feasibility. Schedulers also judged based on utilization (the percentage of time the processor is executing tasks). Optimal w.r.t feasibility schedulers deliver feasible schedules whenever the utilization is 100%. Maximum lateness is another criterion: L max = max i T (f i d i ) Total completion time is also important: M = max i T f i min i T r i H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 10 / 44

11.1.4 Implementation of a Scheduler Thread data structure: Copy of all state (machine registers). Address at which to resume executing the thread. Status of the thread (e.g. blocked on mutex). Priority, worst case execution time, and other info to assist the scheduler. Operating System: Set up periodic timer interrupts. Create default thread data structures. Dispatch a thread. Timer interrupt service routine: Setup next timer interrupt. Dispatch a thread. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 11 / 44

Dispatching a Thread 1 Disable interrupts. 2 Save state (registers) including the return address on the stack. 3 Save the stack pointer into the current thread data structure. 4 Determine which thread should execute (scheduling). 5 If the same one, enable interrupts and return. 6 Restore the stack pointer for the new thread. 7 Copy thread state into machine registers. 8 Replace program counter on the stack for the new thread. 9 Enable interrupts. 10 Return. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 12 / 44

11.2 Rate Monotonic (RM) Scheduling Assume n tasks (i.e., T = {τ 1, τ 2,... τ n }) invoked periodically where each task must complete in each period, p i. Rate monotonic schedule gives higher priority to a task with smaller period, and it is optimal with respect to feasibility. Note: important assumption is that context switch time is negligible. Liu and Leland, Scheduling algorithms for multiprogramming in a hard-real-time environment, J. ACM, 20(1), 1973. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 13 / 44

Example: Two Periodic Tasks e 1 p 1 τ 1 τ 1,1 τ 1,2 τ 1,3 τ 1,4 τ 1,5 τ 1,6 τ 1,7 τ 2 τ 2,1 e 2 p 2 τ 2,2 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 14 / 44

Example: Two Periodic Tasks e 1 p 1 τ 1 τ 1,1 τ 1,2 τ 1,3 τ 1,4 τ 1,5 τ 1,6 τ 1,7 τ 2 τ 2,1 τ 2,2 e 2 p 2 Is a non-preemptive schedule feasible? H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 14 / 44

Example: Two Periodic Tasks e 1 p 1 τ 1 τ 1,1 τ 1,2 τ 1,3 τ 1,4 τ 1,5 τ 1,6 τ 1,7 τ 2 τ 2,1 τ 2,2 e 2 p 2 Is a non-preemptive schedule feasible? No! H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 14 / 44

Example: Two Periodic Tasks e 1 p 1 τ 1 τ 1,1 τ 1,2 τ 1,3 τ 1,4 τ 1,5 τ 1,6 τ 1,7 τ 2 τ 2,1 τ 2,2 e 2 p 2 How about a preemptive schedule with higher priority for red task? H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 14 / 44

Example: Two Periodic Tasks p 1 τ 1 τ 2 + e 2 p 2 How about a preemptive schedule with higher priority for red task? Yes! H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 14 / 44

Worst Case Response Time τ 1 τ 2 τ 1 τ 2 τ 1 τ 2 τ 1 τ 2 o 2 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 15 / 44

Non-RM Schedule Feasible p 1 e 1 τ 1 τ 2 e 2 p 2 Condition for feasibility: e 1 + e 2 p 1 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 16 / 44

RM Schedule Also Feasible e 1 p 1 τ 1 τ 2 e 2 p 2 e 1 + e 2 p 1 feasible schedule H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 17 / 44

Comments Proof can be extended to an arbitrary number of tasks. Proof only gives optimality w.r.t. feasibility, not other optimality criteria. Practical implementation: Timer interrupt at greatest common divisor of the periods. Multiple timers. Note RM schedulers do not always achieve 100 percent utilization. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 18 / 44

11.3 Earliest Deadline First Jackson s earliest due date (EDD) Algorithm (1955) Given n independent one-time tasks with deadlines d 1,..., d n, schedule them to minimize the maximum lateness, defined as L max = max 1 i n {f i d i } where f i is the finishing time of task i. Note that this is negative iff all deadlines are met. Earliest Due Date (EDD) algorithm: Execute them in order of non-decreasing deadlines. Sort tasks such that d 1 d 2... d n. Then, executes τ 1, τ 2,..., τ n. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 19 / 44

11.3 Earliest Deadline First: EDD Note that this does not require preemption. Minimizes the maximum lateness as compared to all other possible orderings. Does not support arrival of tasks, thus no periodic or repeating tasks. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 20 / 44

11.3 Earliest Deadline First Horn s earliest deadline first (EDF) Algorithm (1974) extends EDD to allow tasks to arrive at any time. Given a set of n independent tasks with arbitrary arrival times, any algorithm that at any instant executes the task with the earliest absolute deadline among all arrived tasks is optimal w.r.t. minimizing the maximum lateness. EDF requires the scheduler to always execute the task with the earliest deadline among all arrived tasks. EDF has a dynamic priority making it more difficult to implement. A repeated task may be assigned with different priority at different time. EDF can be applied to periodic tasks as well as aperiodic tasks by making deadline be the end of the period. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 21 / 44

Comparison of EDF and RMS Favoring RMS: Scheduling decisions are simpler (fixed vs. dynamic priorities required by EDF). EDF scheduler must maintain a list of ready tasks that is sorted by priority. Favoring EDF: Since EDF is optimal w.r.t. maximum lateness, it is also optimal w.r.t. feasibility while RMS is only optimal w.r.t. feasibility. EDF can achieve full utilization where RMS fails to do that. EDF results in fewer preemptions in practice, and hence less overhead for context switching. Deadlines can be different from the period. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 22 / 44

11.3.1 EDF with Precedences d 4 = 3 d 2 = 5 d 5 = 5 d 1 = 2 d 3 = 4 d 6 = 6 EDF 1 3 2 4 5 6 LDF EDF* 1 2 4 3 5 6 1 2 4 3 5 6 0 2 4 6 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 23 / 44

Latest Deadline First (Lawler, 1973) Latest deadline first (LDF) builds a schedule backwards. Given a precedence graph, starting from the leaf nodes, choose a node with no other dependent nodes and with the latest deadline to be scheduled last, and work backwards. LDF is optimal in the sense that it minimizes the maximum lateness. It does not require preemption while EDF does. However, it requires that all tasks be available and their precedences known before any task is executed. Does not support arrival of tasks. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 24 / 44

LDF with Precedences d 2 = 5 d 4 = 3 d 5 = 5 d 1 = 2 d 3 = 4 d 6 = 6 EDF 1 3 2 4 5 6 LDF EDF* 1 2 4 3 5 6 1 2 4 3 5 6 0 2 4 6 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 25 / 44

EDF with Precedences (Chetto et al., 1990) With a preemptive scheduler, EDF can be modified to account for precedences and to allow tasks to arrive at arbitrary times. It adjusts the deadlines and arrival times according to the precedences. For a task τ i T, modify its deadline as follows: d i = min(d i, min (d j e j )) j D(i) where D(i) T are the tasks that immediately depend on i in the precedence graph. EDF with precedences (EDF*) is optimal in the sense of minimizing the maximum lateness. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 26 / 44

EDF with Precedences d 2 = 5 d 4 = 3 d 5 = 5 d 1 = 2 d 3 = 4 d 6 = 6 EDF 1 3 2 4 5 6 LDF EDF* 1 2 4 3 5 6 1 2 4 3 5 6 0 2 4 6 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 27 / 44

11.4 Scheduling and Mutual Exclusion Fixed priority scheduler always executes the enabled tasks with highest priority. When threads access shared resources, they need to use mutexes to ensure data integrity. Mutexes can also complicate scheduling. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 28 / 44

Mars Pathfinder H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 29 / 44

Priority Inversion: A Hazard with Mutexes task 1 task 2 task 3 acquire lock preempt block preempt task 1 blocked release done 0 2 4 6 8 10 Task 1 has highest priority, task 3 lowest. Task 3 acquires a lock on a shared object, entering a critical section. It gets preempted by task 1, which then tries to acquire the lock and blocks. Task 2 preempts task 3 at time 4, keeping the higher priority task 1 blocked for an unbounded amount of time. In effect, the priorities of tasks 1 and 2 get inverted, since task 2 can keep task 1 waiting arbitrarily long. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 30 / 44

11.4.2 Priority Inheritance Protocol (PIP) When a task blocks attempting to acquire a lock, the task holding the lock inherits the priority of the blocked task. task 1 blocked task 1 task 2 task 3 acquire lock preempt block at priority of 1 task 2 preempted release done done 0 2 4 6 8 10 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 31 / 44

11.4.3 Priority Ceiling Protocol Priorities can be used to remove certain kinds of deadlocks. task 1 acquire lock a preempt acquire lock b b block on a task 2 a a block on b 0 2 4 6 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 32 / 44

11.4.3 Priority Ceiling Protocol (PCP) Every lock or semaphore is assigned a priority ceiling equal to the priority of the highest-priority task that can lock it. Can one automatically compute the priority ceiling? A task τ can acquire a lock only if the task s priority is strictly higher than the priority ceilings of all locks currently held by other tasks. Intuition: task τ will not later try to acquire these locks held by other tasks. Locks that are not held by any task don t affect the task. This prevents deadlocks. There are extensions supporting dynamic priorities and dynamic creations of locks. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 33 / 44

11.4.3 Priority Ceiling Protocol (PCP) prevented from locking b by priority ceiling protocol task 1 b a lock a preempt unlock b, then a task 2 a a b 0 2 4 6 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 34 / 44

11.5 Multiprocessor Scheduling Scheduling a fixed finite set of tasks with precedence on a finite number of processors with goal to minimize execution time is NP-hard. Hu level scheduling algorithm assigns priority to task τ based on the level. Level is the greatest sum of execution times of tasks on a path in the precedence graph from τ to another task with no dependents. It is a critical path method that is not optimal, but approximates an optimal solution for most graphs. List scheduler assigns tasks to processors based on priorities. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 35 / 44

Precedence Example Revisited d 4 = 3 d 2 = 5 d 5 = 5 d 1 = 2 d 3 = 4 d 6 = 6 EDF 1 3 2 4 5 6 LDF EDF* 1 2 4 3 5 6 1 2 4 3 5 6 0 2 4 6 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 36 / 44

A Two Processor Parallel Schedule Processor A: 1 3 5 6 Processor B: 2 4 0 2 4 H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 37 / 44

11.5.1 Scheduling Anomalies and Brittleness All thread scheduling algorithms are brittle (i.e., small changes can have big, unexpected consequences). Let us consider a schedule for a multiprocessor (or multicore). Theorem (Richard Graham, 1976): If a task set with fixed priorities, execution times, and precedence constraints is scheduled according to priorities on a fixed number of processors, then increasing the number of processors, reducing execution times, or weakening precedence constraints can increase the schedule length. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 38 / 44

Richard s Anomalies e 1 = 3 e 2 = 2 e 3 = 2 e 4 = 2 e 9 = 9 e 8 = 4 e 7 = 4 e 6 = 4 e 5 = 4 proc1 proc2 proc3 2 3 1 4 9 5 7 6 8 0 2 4 6 8 10 12 14 16 time H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 39 / 44

Richard s Anomalies: Smaller Computation Time e 1 = 3 e 2 = 2 e 3 = 2 e 4 = 2 e 9 = 9 e 8 = 4 e 7 = 4 e 6 = 4 e 5 = 4 proc1 proc2 proc3 1 5 8 2 proc1 4 6 1 9 9 proc2 2 4 5 7 3 7 proc3 3 6 8 time 0 2 4 6 8 10 12 14 16 0 2 4 6 8 10 12 14 16 time H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 40 / 44

Richard s Anomalies: More Processors e 1 = 3 e 9 = 9 e 2 = 2 e 3 = 2 e 4 = 2 e 8 = 4 e 7 = 4 e 6 = 4 e 5 = 4 proc1 proc2 proc3 proc4 1 proc1 2 proc2 3 proc3 4 51 26 37 8 4 9 5 7 6 8 time 0 2 0 4 2 6 4 8 6 10 8 12 10 14 1216 14 16 time H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 41 / 44

Richard s Anomalies: Less Precedences Suppose precedences between task 4 and tasks 7 and 8 are removed. e 1 = 3 e 9 = 9 e 2 = 2 e 3 = 2 e 4 = 2 e 8 = 4 e 7 = 4 e 6 = 4 proc1 proc2 proc3 1 8 proc1 2 4 1 5 proc2 3 proc3 27 3 4 6 e 5 = 4 9 9 5 7 6 8 time 0 2 4 6 8 10 12 14 16 time 0 2 4 6 8 10 12 14 16 Remove precedences between task 4 and tasks 7 and 8. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 42 / 44

Richard s Anomalies with Mutexes proc1 proc2 3 1 2 4 5 0 2 4 6 8 10 12 time proc1 proc2 1 3 2 4 5 0 2 4 6 8 10 12 time H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 43 / 44

Concluding Remarks Scheduling is inherently difficult SW execution time hardly to predict accurately. The actual dynamic behavior can be quite different. Timing behavior under all known task scheduling strategies is brittle. Small changes can have big (and unexpected) consequences. Unfortunately, since execution times are so hard to predict, such brittleness can result in unexpected system failures. H. Zheng (CSE USF) CIS 4930/6930: Principles of CPS 44 / 44