Real-Time Process Scheduling Concepts, Design and Implementations

Slides:



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

EE5900 Advanced Embedded System For Smart Infrastructure
Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
Priority Inheritance and Priority Ceiling Protocols
Copyright © 2000, Daniel W. Lewis. All Rights Reserved. CHAPTER 8 SCHEDULING.
1 EE5900 Advanced Embedded System For Smart Infrastructure RMS and EDF Scheduling.
CS 149: Operating Systems February 3 Class Meeting
CS5270 Lecture 31 Uppaal, and Scheduling, and Resource Access Protocols CS 5270 Lecture 3.
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems Resource Access Control Protocols.
UNIT - 7 SCHEDULING.
Real-time concepts Lin Zhong ELEC424, Fall Real time Correctness – Logical correctness – Timing Hard vs. Soft – Hard: lateness is intolerable Pass/Fail.
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.
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
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.
Operating System Concepts and Techniques Lecture 5 Scheduling-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First.
More Scheduling cs550 Operating Systems David Monismith.
MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)
Round Robin Scheduling A preemptive scheduling designed for Time Sharing Systems The Ready Queue is treated as a circular queue A small execution.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
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.
Real time scheduling G.Anuradha Ref:- Stallings. Real time computing Correctness of the system depends not only on the logical result of computation,
Introduction to Embedded Systems Rabie A. Ramadan 5.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Uniprocessor Process Management & Process Scheduling Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi.
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Real-Time Operating Systems RTOS For Embedded systems.
Embedded System Scheduling
REAL-TIME OPERATING SYSTEMS
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Topics Covered What is Real Time Operating System (RTOS)
Scheduling and Resource Access Protocols: Basic Aspects
Wayne Wolf Dept. of EE Princeton University
EEE 6494 Embedded Systems Design
Chapter 2 Scheduling.
Lecture 4 Schedulability and Tasks
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall2014 9/20/2018.
CS 143A - Principles of Operating Systems
Introduction What is an operating system bootstrap
OverView of Scheduling
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall /27/2018.
TDC 311 Process Scheduling.
CSCI1600: Embedded and Real Time Software
Scheduling.
COT 4600 Operating Systems Spring 2011
CPU SCHEDULING.
CGS 3763 Operating Systems Concepts Spring 2013
Process Scheduling Decide which process should run and for how long
EE 472 – Embedded Systems Dr. Shwetak Patel.
CSCI1600: Embedded and Real Time Software
Processes and operating systems
Chapter 10 Multiprocessor and Real-Time Scheduling
Scheduling.
Uniprocessor Process Management & Process Scheduling
Deadlock Prevention & Avoidance
Process Synchronization
Real-Time Process Scheduling Concepts, Design and Implementations
Chapter 6: Scheduling Algorithms Dr. Amjad Ali
Department of Computer Science
Department of Computer Science
Chapter 6: CPU Scheduling
Deadlock Prevention & Avoidance
Process Synchronization
Uniprocessor Process Management & Process Scheduling
Presentation transcript:

Real-Time Process Scheduling Concepts, Design and Implementations CS 314 Operating Systems Real-Time Process Scheduling Concepts, Design and Implementations Department of Computer Science Southern Illinois University Edwardsville Fall, 2018 Dr. Hiroshi Fujinoki E-mail: hfujino@siue.edu RT_Schedule/000

CS 314 Operating Systems Real-Time Systems = (Computer) systems that are designed to execute “real-time tasks” “Real-time tasks” are activities (or sets of activities) that should (or must) be executed within some time limits. RT_Schedule/001

CS 314 Operating Systems Real-Time Systems - as embedded-systems RT_Schedule/002 http://www.slideshare.net/iquadri/presto-improvements-of-industrial-realtime-embedded-systems-design-and-development

CS 314 Operating Systems Real-Time Systems Example: NASA Mars Rover Landing Mission https://www.youtube.com/watch?v=oNviFQpRvwQ RT_Schedule/003

CS 314 Operating Systems Real-Time Systems Real-time process schedulers schedule processes based on process’ “execution deadlines” RT_Schedule/004

CS 314 Operating Systems Real-Time Systems = (Computer) systems that are designed to execute “real-time tasks” “Real-time tasks” are activities (or sets of activities) that should (or must) be executed within some time limits. The real-time systems that should execute tasks in time limits The real-time systems that must execute tasks in time limits “soft real-time systems” “hard real-time systems”  Determinism “Time limits”  Responsiveness  Response Time RT_Schedule/005

CS 314 Operating Systems     Determinism & Responsiveness Response Time Determinism Responsiveness     What are going here? t0 t1 t2 Time A processor is assigned by the short-term scheduler A task arrives (for execution) This task is completed Context Switching  Another task is being executed  Save the process state (and the processor registers) of this process to memory  Process scheduler overhead (the scheduler needs to select who is next)  Load the process state (and its registers) of the next process RT_Schedule/006

CS 314 Operating Systems Determinism & Responsiveness Response Time What makes meeting this deadline difficult?  Accurately predicting how long a task takes is sometime difficult.  A higher-priority task (than this) can preempt this task  Unpredictable interrupts can (will) happen - Hardware interrupt (at clock-ticks from real-time hardware clock) - Software interrupt (“signal” message to a process on “wait”) RT_Schedule/007

CS 314 Operating Systems Determinism & Responsiveness Determinism Time needed before the OS initiates a required task (since a task is requested). “Initiates” here means the task is assigned a processor by the short-term scheduler (not by the long-term scheduler). Important metric for “start deadline” Responsiveness Time the OS completes an initiated task Response-Time = Determinism + Responsiveness RT_Schedule/008

CS 314 Operating Systems Four Different Classes of Real-Time Scheduling Table-Driven Priority-Driven  Static Table-Driven Scheduling  Static Priority-Driven Static Scheduling Create a schedule first Real-Time Scheduling Follow the schedule without a change Dynamic Scheduling Planning-Based Best-Effort  Dynamic Planning-Based Scheduling  Dynamic Best-Effort Can create a schedule first Dynamically update the schedule RT_Schedule/009

CS 314 Operating Systems Four Different Classes of Real-Time Scheduling = To be discussed  Static Table-Driven Scheduling (a) Completion-Time Earliest-Deadline (b) Start-Time Earliest-Deadline  Static Priority-Driven Scheduling Rate Monotonic Scheduling (RMS)  Dynamic Planning-Based Scheduling  Dynamic Best-Effort Scheduling (a) Priority-Driven Non-Preemptive (b) Priority-Driven Immediate Preemption (c) Priority-Driven Immediate Preemption on (periodic) preemption-points (d) Round-Robin RT_Schedule/010

CS 314 Operating Systems  Static Table-Driven Scheduling - For periodic real-time tasks Event interval should be known for each real-time process Task-processing time should be known Process Arrival Time Execution Time Ending Deadline When to Start    A(1) A(2) A(3) B(1) B(2) 20 40 10 60 50 25 100    The short-term scheduler pre-calculates when to start RT_Schedule/011

CS 314 Operating Systems  Static Table-Driven Scheduling Scheduling happens when:  A new task arrives Completion-time (response time) deadline OR Earliest-Deadline First  A task is completed Preemptive The short-term scheduler pre-calculates this in advance No priority B1 preempted B2 preempted Time 50 100 A1 B1 A2 B1 B1 A3 A3 B2 A4 B2 B2 A5 10 20 30 40 60 70 80 90 110 120 A1(20) B1(50) B1(50) B1(50) B1(50) B2(100) A5(100) B2(100) A2(40) A3(60) B1(50) A3(60) A4(80) B2(100) A3(60) B2(100) A5(100) B2(100) RT_Schedule/012

CS 314 Operating Systems  Static Priority-Driven Scheduling Performs both short/long-term scheduling Rate-Monotonic-Scheduling Priority-based scheduling (for the short-term scheduling) Concept of “rate” in RMS For periodic real-time tasks Rate = 1/P P P Idle Time T1 T2 T3 Time C (Running Time) RMS Assign the highest priority to the process that has the largest rate RT_Schedule/013

CS 314 Operating Systems  Static Priority-Driven Scheduling Short-term Scheduling Long-term Scheduling For each new process i Short-Term Priority H L Rate (=1/P) Calculate the utilization (Ui) as Ui = Ci/Pi RMS-Feasibility Test Then, the RMS long-term scheduler rejects the new process if: RT_Schedule/014

CS 314 Operating Systems  Static Priority-Driven Scheduling Processes Preemptive priority-based scheduling Processes Running Time (C) Task Period (P) Rate (1/P) Priority Process 1 Process 2 Process 3 20 40 100 100 150 350 0.01 0.006 0.002 H L M Long-Term Feasibility Test: = 0.2 + 0.267 + 0.286  1.0 = 0.2 + 0.267 + 0.286  n(21/n-1) (These three processes are schedulable for MRS) Assign Short-Term Priority: Since 0.2 (P1) < 0.267 (P2) < 0.286 (P3) Process 1  Process 2 Process 3 Highest Priority Lowest Priority Medium Priority RT_Schedule/015

CS 314 Operating Systems  Static Priority-Driven Scheduling RMS uses this sufficient condition  Static Priority-Driven Scheduling Processes Running Time (C) Cycle (T) Rate (1/T) Process 1 Process 2 20 100 30 145 Process 3 68 150 0.200 0.206 0.453 Necessary Condition = 0.2 + 0.206 + 0.453 = 0.859  1.0 Sufficient Condition = 0.2 + 0.206 + 0.453  n(21/n-1) = 0.779 RT_Schedule/016

CS 314 Operating Systems  Dynamic Best-Effort Scheduling Task N has the highest priority (a) Priority-Driven Non-Preemptive Meeting responsiveness for task N? Meeting determinism for task N?  (Because of non-preemptive) Although N has a higher priority, N can’t start since 1 does not give up  (Because of non-preemptive) Task-N is completed at t2 t2 Determinism(N) Responsiveness(N) tX Task-1 releases the processor at t1 t1 Responsiveness(1) Task 1 Task N t0 Time N Task-N with a higher priority arrives at t0  Determinism is out-of-control RT_Schedule/017

CS 314 Operating Systems  Dynamic Best-Effort Scheduling (b) Priority-Driven Immediate Preemptive Although N has a higher priority, N can’t start since 1 does not give up Task-N is completed at t2 Determinism Responsiveness t0 t1 t2 Task 1 Task N Time Task-N with a higher priority arrives at t0 Task-1 releases the processor at t1 RT_Schedule/018

CS 314 Operating Systems  Dynamic Best-Effort Scheduling (b) Priority-Driven Immediate Preemptive (continued) Meeting determinism (N)? Meeting responsiveness (N)?   N’s determinism tR Task-N-1 is completed at tR Task-N is completed at tC tC Let N preempts 1 immediately = 0 Responsiveness(N) tX t0 Task-N with a higher priority arrives at t0 Task-1 Responsiveness Task 1 Task N Task (N-1) Task 1 Time  Responsiveness is out-of-control RT_Schedule/019

after Task-N is requested CS 314 Operating Systems  Dynamic Best-Effort Scheduling (c) Priority-Driven Preemption on (periodic) preemption-points C = a hardware-clock interrupt Hardware-clock interrupt is a special interrupt caused by the hardware-clock periodically at a fixed time interval C C t C t C t tS t0 Task-N with a higher priority arrives at t0 tC1 tC2 tC3 Responsiveness Task 1 Task N Time tX The first HC interrupt after Task-N is requested Determinism(N): Responsiveness(N): tX – t0 guaranteed up to t RT_Schedule/020

CS 314 Operating Systems  Dynamic Best-Effort Scheduling (c) Priority-Driven Immediate Preemption on (periodic) preemption-points Although N has a higher priority, N can’t start since 1 does not give up If non-preemptive Responsiveness Task N Task-1 releases the processor at t1 t1 Task-N is completed at t2 t2 Determinism Task 1 t0 Time Task-N with a higher priority arrives at t0  Determinism is out-of-control RT_Schedule/021

CS 314 Operating Systems  Dynamic Best-Effort Scheduling If (task time) < (time-slice) this is the responsiveness (d) Round-Robin Time-Slice Determinism Task 1 Task 2 Task 3 Task (N-1)    Task N t0 Time  Meeting responsiveness Meeting determinism Depends on what? RT_Schedule/022

CS 314 Operating Systems  Dynamic Best-Effort Scheduling (d) Round-Robin (continued) Time-Slice Determinism Task 1 Task 2 Task 3 Task (N-1)    Task N t0 Time Time-Slice TN Time-Slice TN    Time-Slice TN    Determinism Task-N finishes T1 T2 T3 TN-1    Time t0 Responsiveness RT_Schedule/023

CS 314 Operating Systems  Dynamic Best-Effort Scheduling Determinism T1 T2 T3 TN-1    Time-Slice TN Time t0 Responsiveness Task-N finishes Meeting “determinism” requirement easier if: Meeting “responsiveness” requirement easier if: Reduce the degree of multi-tasking Same Reduce the degree of multi-tasking Reduce Round-Robin Time Slice Increase Round-Robin Time Slice Tradeoff RT_Schedule/024

CS 314 Operating Systems Priority Inversion A situation where a higher-priority task must wait for a lower-priority task even in a preemptive priority-based scheduling. Something that should not happen H - A high-priority task L - A low-priority task R - Resource that requires exclusive access H L R (H waits on R)  Request  Request  Assigned H requests R H starts H gets blocked H L t3 H gets R and ready L starts first L gets the processor t0 t1 t2 t4 L releases R L locks on R Time Priority-Inversion RT_Schedule/025

CS 314 Operating Systems M Unbounded Priority Inversion H - A high-priority task L - A low-priority task R - Resource that requires exclusive access H L R  Request  Assigned  Request (H waits on R) M - A medium-priority task H requests R H L t0 t1 t2 t3 t4 L releases R L locks on R Time Priority-Inversion RT_Schedule/026

1. Mars Pathfinder Priority Inversion Incident On July 4th, 1997, the Mars Pathfinder landed to a media fanfare and began to transmit data back to Earth. Days later and the flow of information and images was interrupted by a series of total systems resets.

CS 314 Operating Systems Unbounded Priority Inversion M H - A high-priority task L - A low-priority task R - Resource that requires exclusive access H L R  Request  Assigned  Request (H waits on R) M - A medium-priority task H requests R M requests for execution (requests for the processor) H L  We never know when L releases R M2 t3 M t4 t0 t1 L locks on R t2 L can not release R Priority-Inversion Unbounded Priority-Inversion RT_Schedule/027