Lecture 12: Real-Time Scheduling

Slides:



Advertisements
Similar presentations
CPE555A: Real-Time Embedded Systems
Advertisements

Abdulrahman Idlbi COE, KFUPM Jan. 17, Past Schedulers: 1.2 & : circular queue with round-robin policy. Simple and minimal. Not focused on.
Chapter 20: Multimedia Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 20: Multimedia Systems What is Multimedia.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 20: Multimedia Systems.
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.
Computer Organization and Architecture
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
Chapter 3 Overview of Operating Systems Copyright © 2008.
Chapter 19: Real-Time Systems
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 34 – Media Server (Part 3) Klara Nahrstedt Spring 2012.
Lecture 5: CPU Scheduling. Lecture 5 / Page 2AE4B33OSS Silberschatz, Galvin and Gagne ©2005 Contents Why CPU Scheduling Scheduling Criteria & Optimization.
Chapter 19: Real-Time Systems Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 19: Real-Time Systems System Characteristics Features of Real-Time.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 19/20: Real-time and Multimedia Systems Inclusions from Tanenbaum,
XE33OSA Chapter 20: Multimedia Systems. 20.2XE33OSA Silberschatz, Galvin and Gagne ©2005 Chapter 20: Multimedia Systems What is Multimedia Compression.
Dr. M. Munlin Real-Time and Multimedia Systems 1 NETE0516 Operating Systems Instructor: ผ. ศ. ดร. หมัดอามีน หมัน หลิน Faculty of Information Science and.
Scheduling policies for real- time embedded systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Multimedia Systems.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
CE Operating Systems Lecture 7 Threads & Introduction to CPU Scheduling.
Advanced Operating Systems - Spring 2009 Lecture 14 – February 25, 2009 Dan C. Marinescu Office: HEC 439 B. Office.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
19.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 19: Real-Time Systems.
Chapter 19: Real-Time Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 19: Real-Time Systems System Characteristics.
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 31 – Process Management (Part 1) Klara Nahrstedt Spring 2009.
For a good summary, visit:
1.  System Characteristics  Features of Real-Time Systems  Implementing Real-Time Operating Systems  Real-Time CPU Scheduling  An Example: VxWorks5.x.
CONCEPTS OF REAL-TIME OPERATING SYSTEM. OBJECTIVE  To Understand Why we need OS?  To identify Types of OS  To Define Real - Time Systems  To Classify.
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.
Chapter 20: Multimedia Systems
REAL-TIME OPERATING SYSTEMS
Multimedia Systems Operating System Presentation On
Chapter 19: Real-Time Systems
Chapter 20: Multimedia Systems
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Networks and Operating Systems: Exercise Session 2
Lecture Topics: 11/1 Processes Process Management
Unit OS9: Real-Time and Embedded Systems
Chapter 2 Scheduling.
Chapter 8 – Processor Scheduling
Chapter 2.2 : Process Scheduling
Lecture 4 Schedulability and Tasks
Lecture 24: Process Scheduling Examples and for Real-time Systems
Chapter 20: Multimedia Systems
ICS 143 Principles of Operating Systems
Chapter 6: CPU Scheduling
Lecture 21: Introduction to Process Scheduling
Operating System Concepts
Chapter 2: The Linux System Part 3
TDC 311 Process Scheduling.
CSCI1600: Embedded and Real Time Software
Operating systems Process scheduling.
CPU SCHEDULING.
Lecture Topics: 11/1 General Operating System Concepts Processes
CPU scheduling decisions may take place when a process:
Multiprocessor and Real-Time Scheduling
Chapter 6: CPU Scheduling
Process Scheduling Decide which process should run and for how long
EE 472 – Embedded Systems Dr. Shwetak Patel.
Chapter 19: Real-Time Systems
CSCI1600: Embedded and Real Time Software
Lecture 21: Introduction to Process Scheduling
CS703 - Advanced Operating Systems
Chapter 20: Multimedia Systems
Shortest-Job-First (SJR) Scheduling
Chapter 6: CPU Scheduling
Chapter 20: Multimedia Systems
Chapter 20: Multimedia Systems
Scheduling of Regular Tasks in Linux
Presentation transcript:

Lecture 12: Real-Time Scheduling Nov. 22, 2016 Kyu Ho Park 1

Issues Timing requirements of real-time systems Hard and Soft real-time systems Characteristics of real-time systems Scheduling algorithms for hard real-time systems Linux Scheduler( CFS )

Overview of Real-Time Systems A real-time system requires that results be produced within a specified deadline period. An embedded system is a computing device that is part of a larger system (I.e. automobile, airliner.) A safety-critical system is a real-time system with catastrophic results in case of failure. A hard real-time system guarantees that real-time tasks be completed within their required deadlines. A soft real-time system provides priority of real-time tasks over non real-time tasks.

Features of Real-Time Kernels Most real-time systems do not provide the features found in a standard desktop system. Reasons include Real-time systems are typically single-purpose. Real-time systems often do not require interfacing with a user. Features found in a desktop PC require more substantial hardware that what is typically available in a real-time system.

Virtual Memory in Real-Time Systems Address translation may occur via: (1) Real-addressing mode where programs generate actual addresses. (2) Relocation register mode. (3) Implementing full virtual memory.

Address Translation

Implementing Real-Time Operating Systems In general, real-time operating systems must provide: (1) Preemptive, priority-based scheduling (2) Preemptive kernels (3) Latency must be minimized

Minimizing Latency Event latency is the amount of time from when an event occurs to when it is serviced.

Interrupt Latency Interrupt latency is the period of time from when an interrupt arrives at the CPU to when it is serviced.

Classification of RT Schedulers

Real-Time CPU Scheduling Periodic processes require the CPU at specified intervals (periods) p is the duration of the period d is the deadline by when the process must be serviced t is the processing time

Scheduling of tasks Scheduling of tasks when P2 has a higher priority than P1

Rate Montonic Scheduling A priority is assigned based on the inverse of its period Shorter periods = higher priority; Longer periods = lower priority P1 is assigned a higher priority than P2.

Scheduling of tasks Missed Deadlines with Rate Monotonic Scheduling

Earliest Deadline First Scheduling Priorities are assigned according to deadlines: The earlier the deadline, the higher the priority; the later the deadline, the lower the priority.

EDF EDF scheduling EDF scheduling is theoretically optimal. Example: It does not require periodic processes. It only requires the deadlines of processes. EDF scheduling is theoretically optimal. Example: arrival duration deadline P1 10 33 P2 4 3 28 P3 5 29

Delayed Locking Technique[JPLee&KPARK,2008] NP RT P preemptible section OS Latency NP non-preemptible section (critical section) urgent interrupt RT real-time process section P RT NP urgent interrupt “Entering a critical section is allowed only if the operation does not disturb the future execution of the real-time application” OS Latency is significantly reduced at the expense of delaying execution of NP section

Locking Decision (a) Locking is prohibited (delayed) enter ith section P RT NP tlock,i > tintr,j ? Y N tintr,j tlock,i decision point urgent timer interrupt Locking is prohibited Locking is allowed (b) Locking is allowed enter wait queue P NP P RT tlock,i tintr,j tintr,j : time remaining until the next j-th urgent interrupt tlock,i : time taken to execute an i-th non-preemptible section (lock hold time) decision point urgent timer interrupt

OS Latency w/o delayed locking w/ delayed locking minimum 24 us 22 us maximum 847 us 192 us average 197.14 us 63 us Computer Engineering Research Laboratory, EECS, KAIST

Media Delivery Multimedia data is stored in the file system like other ordinary data. However, multimedia data must be accessed with specific timing requirements. For example, video must be displayed at 24-30 frames per second. Multimedia video data must be delivered at a rate which guarantees 24-30 frames/second. Continuous-media data is data with specific rate requirements.

Streaming Streaming is delivering a multimedia file from a server to a client - typically the deliver occurs over a network connection. There are two different types of streaming: 1. Progressive download - the client begins playback of the multimedia file as it is delivered. The file is ultimately stored on the client computer. 2. Real-time streaming - the multimedia file is delivered to - but not stored on - the client’s computer.

Real-time Streaming There are two types of real-time streaming: (1) Live streaming - used to deliver a live event while it is occurring. (2) On-demand streaming - used to deliver media streams such as movies, archived lectures, etc. The events are not delivered in real-time.

Linux Scheduler History Linux 1.0 Simple linked list of Runnable Processes. Linux 2.0 SMP support Linux 2.5 O(1) Scheduler : Priority sorted array of lists Linux 2.6.23 CFS :Completely Fair Scheduler O(1) Scheduler RT Priority 99 .. RT Priority 1 Nice -20 Nice +19

CFS Scheduler Separate Scheduler Classes rt_sched_class O(1) priority array fair_sched_class Red and Black Tree(O(log(N)) idle_sched_class Handles idle tasks

CFS Scheduler Decision Sstart with rt_sched_class runnable task available pick next sched_class Spick next task of sched_class

CFS It maintains a virtual run time(VRT) for each process: The VRT represents how long each process has run on the CPU. The smaller the VRT value, the higher priority. All ready processes are maintained in a red-black tree ordered by increasing virtual run times. O(logN) insertion time complexity and O(1) look up for next process to run.

CFS

Red-Black Tree

Homework #4 Task: Make your program to construct the red-black tree based on the virtual run time of each process. Assume that int pid; int vrt[pid]={27,19,34,65,37,7,49,2,98}; Remove the leftmost node and restructure the red-black tree until all vrt[] nodes are removed from the tree. Submission Due Date : Dec.2, PM 23:59 Delay Penalty 10%/day E-mail : Kim Woo Joong w.j.kim@kaist.ac.kr [EE516 Home4] student_number.zip

Project 5 Related: Project 5 will be issued on Nov. 29,2016. The number of Beagle board black(BBB) is limited so that a BBB kit will be allocated to each team which consists of 2 students. Please decide your team mate until Nov. 29 and send the names to Mr. Kim, Woo Joong, w.j.kim@kaist.ac.kr.