CSCI1600: Embedded and Real Time Software

Slides:



Advertisements
Similar presentations
Washington WASHINGTON UNIVERSITY IN ST LOUIS Real-Time: Periodic Tasks Fred Kuhns Applied Research Laboratory Computer Science Washington University.
Advertisements

Real Time Scheduling.
Introduction to Embedded Systems Resource Management - III Lecture 19.
Scheduling Criteria CPU utilization – keep the CPU as busy as possible (from 0% to 100%) Throughput – # of processes that complete their execution per.
CPE555A: Real-Time Embedded Systems
CSE 522 Real-Time Scheduling (4)
Tasks Periodic The period is the amount of time between each iteration of a regularly repeated task Time driven The task is automatically activated by.
Module 2 Priority Driven Scheduling of Periodic Task
Chapter 6 Dynamic Priority Servers
CSE 421 Algorithms Richard Anderson Lecture 6 Greedy Algorithms.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
Real-Time Operating System Chapter – 8 Embedded System: An integrated approach.
Module 2 Clock-Driven Scheduling
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
Scheduling policies for real- time embedded systems.
RTOS task scheduling models
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems RMS and EDF Schedulers.
CSCI1600: Embedded and Real Time Software Lecture 25: Real Time Scheduling III Steven Reiss, Fall 2015.
1 Real-Time Scheduling. 2Today Operating System task scheduling –Traditional (non-real-time) scheduling –Real-time scheduling.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Dynamic Priority Driven Scheduling of Periodic Task
Real-Time Operating Systems RTOS For Embedded systems.
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
REAL-TIME OPERATING SYSTEMS
Multiprocessor Real-Time Scheduling
lecture 5: CPU Scheduling
EMERALDS Landon Cox March 22, 2017.
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Scheduling and Resource Access Protocols: Basic Aspects
Networks and Operating Systems: Exercise Session 2
Wayne Wolf Dept. of EE Princeton University
Unit OS9: Real-Time and Embedded Systems
Chapter 2 Scheduling.
Real-time Software Design
Lecture 24: Process Scheduling Examples and for Real-time Systems
CprE 458/558: Real-Time Systems
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall2014 9/20/2018.
Chapter 6: CPU Scheduling
CSCI1600: Embedded and Real Time Software
Module 5: CPU Scheduling
Richard Anderson Autumn 2015 Lecture 8 – Greedy Algorithms II
Chapter 6 Dynamic Priority Servers
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall /27/2018.
3: CPU Scheduling Basic Concepts Scheduling Criteria
Chapter5: CPU Scheduling
TDC 311 Process Scheduling.
CSCI1600: Embedded and Real Time Software
CPU scheduling decisions may take place when a process:
Greedy Algorithms: Homework Scheduling and Optimal Caching
Richard Anderson Lecture 6 Greedy Algorithms
Chapter 6: CPU Scheduling
Scheduling Basic Concepts Ref: Hard Real-Time Computing Systems Giorgio Buttazzo Ref: Real-Time Systems & Software Alan Shaw Processes - Tasks.
Richard Anderson Autumn 2016 Lecture 7
CSCI1600: Embedded and Real Time Software
Processes and operating systems
Richard Anderson Lecture 7 Greedy Algorithms
Richard Anderson Winter 2019 Lecture 8 – Greedy Algorithms II
Operating System , Fall 2000 EA101 W 9:00-10:00 F 9:00-11:00
Richard Anderson Autumn 2016 Lecture 8 – Greedy Algorithms II
Shortest-Job-First (SJR) Scheduling
Richard Anderson Winter 2019 Lecture 7
Module 5: CPU Scheduling
Richard Anderson Autumn 2015 Lecture 7
CSCI1600: Embedded and Real Time Software
Module 5: CPU Scheduling
Richard Anderson Autumn 2019 Lecture 7
Richard Anderson Autumn 2019 Lecture 8 – Greedy Algorithms II
CPU Scheduling David Ferry CSCI 3500 – Operating Systems
Presentation transcript:

CSCI1600: Embedded and Real Time Software Lecture 27: Real Time Scheduling III Steven Reiss, Fall 2017 A bit short.

Relaxing Constraints Non-preemptability Resource Contention Self-suspension Context Switching time Sporadic and aperiodic jobs Job dependencies Multiple cores/threads/processors Lecture 28: Scheduling III 12/31/2018

Aperiodic Job Scheduling Aperiodic Tasks Arise occasionally Soft deadlines Might be prioritized Goal: minimize worst/average case performance Lecture 28: Scheduling III 12/31/2018

Simple Aperiodic Scheduling Run aperiodic tasks in open slots How to schedule them Round robin Prioritized round robin Run tasks with higher priorities first Allocate CPU time according to priority This gives no guarantees of performance Lecture 28: Scheduling III 12/31/2018

Total Bandwidth Server Make an aperiodic job look like a sporadic one Add to schedule using standard algorithm (e.g. EDF) Can reject the sporadic job if necessary Key: set the parameters for the job so that The result is schedulable (total U <= 1 or U <= ln(2)) Recall U = e/D e is known and fixed for the job This lets us vary D to accommodate the jobs Lecture 28: Scheduling III 12/31/2018

Total Bandwidth Server Determine desired aperiodic load Us To still allow sporadic jobs and periodic jobs Total U <= 1 or ln(2) TBS is configured with budget Qs and period Ts Qs/Ts = Us Terminology es : budget for the server (its execution time) eq : execution time of job at the head of the queue us : size of the server (max utilization) Lecture 28: Scheduling III 12/31/2018

Total Bandwidth Server Initially es = 0 and d = 0 When a new job with execution time e comes into an empty queue Set d = max(d,t) + e/us Set es = e When the server completes the current job, remove the job from the queue If there are more jobs, Set d= d+eq/us Set es= eq Lecture 28: Scheduling III 12/31/2018

Example Periodic: P1(4,1), P2(6,3) Aperiodic: A3: e=2 at time 1, A4: e= 1 at time 2 First determine Us Up = ¼ + 3/6 = 0.75 Us = 0.25 (could be less) Lecture 28: Scheduling III 12/31/2018

Example P1 P2 P3 At Start P1(4,1), P2(6,3), es= 0, d = 0 A3: e=2 at time 1 At time 1: d = max(0,1) + 2 / 0.25 = 9, es = 2 Lecture 28: Scheduling III 12/31/2018

Example P1 P2 P3 P1(4,1), P2(6,3), Ps(9,2) At time 3: new aperiodic job Pt (A4: e= 1 at time 2), but Ps not done At time 7: Ps finishes, P2 has deadline 12 Lecture 28: Scheduling III 12/31/2018

Example P1 P2 P3 At time 7: d = d + eq/Us = 9 + 1/0.25 = 13, es = 1 Ps(13,1) Lecture 28: Scheduling III 12/31/2018

Example P1 P2 P3 At time 7: d = d + eq/Us = 9 + 1/0.25 = 13, es = 1 Ps(13,1) P1 and P2 have deadlines of 12 Lecture 28: Scheduling III 12/31/2018

Handling Task Dependencies Suppose tasks depend on one another Represent this as a precedence relation Ti -> Tj if Ti must precede Tj Why would this arise? How can we schedule the result EDF doesn’t work directly Lecture 28: Scheduling III 12/31/2018

EDF* Scheduling Let Di be the deadline for task i Let ei be the execution time for task i Define D’i as the modified deadline for task i D’i = min(Di,MIN(Tj dependent on Ti)[D’j – ej]) Then use EDF on the modified deadlines Lecture 28: Scheduling III 12/31/2018

Jitter Periodic jobs are not perfectly periodic Compute maximum jitter and add to execution/deadline Lecture 28: Scheduling III 12/31/2018

Thread Scheduling All our schedules assume single core, single thread This might not be realistic today Can we just use these techniques for multithreaded scheduling? Using any available processor What can go wrong? Lecture 28: Scheduling III 12/31/2018

Thread Scheduling Assume m processors, m+1 tasks What happens? Tasks 1..m are (1,2e) for small e (2me < 1) Task m+1 is (1+e,1) Try: m = 4, 1-4 (10,2); 5: (11,10) What happens? Using EDF/RM/DM Tasks 1..m are all scheduled But then m+1 can’t run Even though there is lots of idle time Other anomalies are possible (esp. w/ synchronization) Lecture 28: Scheduling III 12/31/2018

Thread Scheduling Can still use the basic algorithms Assign each task to a particular thread Ensure the utilization of that thread is <= 1 Then you can use EDF (RM/DM) to schedule the thread Optimal assignment is NP-hard But approximations are pretty good Lecture 28: Scheduling III 12/31/2018

Practical Scheduling What should be done in practice? What should a general purpose OS do? Suppose we just assign priorities to jobs Run the job with the highest priority at any time What is the result? Lecture 28: Scheduling III 12/31/2018

Scheduling Exercise P1(8,4), P2(12,4), P3(20,4) Lecture 28: Scheduling III 12/31/2018

Adding Sound Samples Assume you have 2 sounds You want to play them simultaneously Sounds are 8 bit 8K samples In theory, you just add the waves Result should be a new wave Lecture 28: Scheduling III 12/31/2018

Problems with Adding What are the 8 bit values (what is 0?) 128 == 0, smaller values negative, larger positive Thus sample = x+128 (x+128) + (y+128) = (x+y)+256 [wrong] (x+128-128) + (y+128-128) + 128 = (x+y)+128 What happens if sum >= 128 or < -128 Need to set result to 255 or 0 Clipping occurs (doesn’t sound that good) Can scale the two sounds if needed Original sounds shouldn’t use full range Lecture 28: Scheduling III 12/31/2018

Next Time Real Time Operating Systems Lecture 28: Scheduling III 12/31/2018