Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall2013 11/27/2018.

Slides:



Advertisements
Similar presentations
Operating Systems Semaphores II
Advertisements

Real Time Scheduling.
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
Priority INHERITANCE PROTOCOLS
Copyright © 2000, Daniel W. Lewis. All Rights Reserved. CHAPTER 8 SCHEDULING.
1 EE5900 Advanced Embedded System For Smart Infrastructure RMS and EDF Scheduling.
B. RAMAMURTHY 4/13/2015 cse321-fall2014 Realtime System Fundamentals : Scheduling and Priority-based scheduling Pag e 1.
0 Synchronization Problem Resource sharing –Requires mutual exclusion –Critical section A code section that should be executed mutually exclusively by.
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.
CSE 522 Real-Time Scheduling (3)
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
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.
1 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5.
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Semaphores. Announcements No CS 415 Section this Friday Tom Roeder will hold office hours Homework 2 is due today.
By Group: Ghassan Abdo Rayyashi Anas to’meh Supervised by Dr. Lo’ai Tawalbeh.
Race Conditions CS550 Operating Systems. Review So far, we have discussed Processes and Threads and talked about multithreading and MPI processes by example.
Spring 2002Real-Time Systems (Shin) Rate Monotonic Analysis Assumptions – A1. No nonpreemptible parts in a task, and negligible preemption cost –
Semaphores. Readings r Silbershatz: Chapter 6 Mutual Exclusion in Critical Sections.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
SYNCHRONIZATION Module-4. scheduling Scheduling is an operating system mechanism that arbitrate CPU resources between running tasks. Different scheduling.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
6.3 Peterson’s Solution The two processes share two variables: Int turn; Boolean flag[2] The variable turn indicates whose turn it is to enter the critical.
Real-Time Scheduling CS4730 Fall 2010 Dr. José M. Garrido Department of Computer Science and Information Systems Kennesaw State University.
B. RAMAMURTHY 12/25/2015 Realtime System Fundamentals : Scheduling and Priority-based scheduling Pag e 1.
CSCI1600: Embedded and Real Time Software Lecture 24: Real Time Scheduling II Steven Reiss, Fall 2015.
Introduction to Embedded Systems Rabie A. Ramadan 5.
CSCI1600: Embedded and Real Time Software Lecture 23: Real Time Scheduling I Steven Reiss, Fall 2015.
Sandtids systemer 2.modul el. Henriks 1. forsøg m. Power Point.
3/1/2016Page 1 Realtime System Fundamentals : Scheduling B. Ramamurthy.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Mutual Exclusion Mutexes, Semaphores.
Distributed Process Scheduling- Real Time Scheduling Csc8320(Fall 2013)
Real-Time Operating Systems RTOS For Embedded systems.
Process Synchronization. Concurrency Definition: Two or more processes execute concurrently when they execute different activities on different devices.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Embedded System Scheduling
REAL-TIME OPERATING SYSTEMS
CS703 – Advanced Operating Systems
COT 4600 Operating Systems Fall 2009
Process Synchronization: Semaphores
Scheduling and Resource Access Protocols: Basic Aspects
Background on the need for Synchronization
Applied Operating System Concepts -
EEE 6494 Embedded Systems Design
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall2014 9/20/2018.
Inter-Process Communication and Synchronization
Critical Section and Critical Resources
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy 11/22/2018.
Critical Section and Critical Resources
Topic 6 (Textbook - Chapter 5) Process Synchronization
Semaphore Originally called P() and V() wait (S) { while S <= 0
CSCI1600: Embedded and Real Time Software
Realtime System Fundamentals
Lecture 2 Part 2 Process Synchronization
Realtime System Fundamentals
Multiprocessor and Real-Time Scheduling
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy Amrita-UB-MSES /11/2013.
CSCI1600: Embedded and Real Time Software
Processes and operating systems
Realtime System Fundamentals
Midterm Review CSE321 B.Ramamurthy 4/4/2019 B.Ramamurthy.
CHAPTER 8 Resources and Resource Access Control
Real-Time Process Scheduling Concepts, Design and Implementations
Real-Time Process Scheduling Concepts, Design and Implementations
EECE.4810/EECE.5730 Operating Systems
Presentation transcript:

Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall2013 11/27/2018

Realtime scheduling Realtime system scheduling as in: Earliest deadline scheduling (EDS) Starting deadline Completion deadline Dynamic priority scheduling Rate monotonic scheduling (RMS) Periodic tasks are prioritized by the frequency of repetition (high priority to tasks with shorter periods) Preemptive scheduling Fixed priority scheduling Schedulability according to RMS Σ(Ci/Ti) <= n(21/n-1) Cyclic executives (pre-scheduled) Concepts of cycle, slot and frame Repeated execution times cse321-fall2013 11/27/2018

Task State Diagram New Ready Blocked Run 11/27/2018 Task admitted Resources allocated Dispatched; cpu allocated Event occurred Task exit Blocked Run Waiting for event cse321-fall2013 11/27/2018

Deadline driven scheduling Parameters: ready time, starting deadline, completion deadline, processing time, resource requirement, priority, preemptive or non-preemptive cse321-fall2013 11/27/2018

Deadline Scheduling Process Arrival Time Execution Time Ending Deadline A(1) 0 10 20 A(2) 20 10 40 A(3) 40 10 60 A(4) 60 10 80 A(5) 80 10 100 • • • • B(1) 0 25 50 B(2) 50 25 100 cse321-fall2013 11/27/2018

Fixed-priority scheduling; A has priority B has priority deadline A1 B1 A2 B1 A3 B2 A4 B2 A5 B2 A1 A2 B1 A3 A4 A5, B2 (missed) A1 A2 A3 A4 A5, B2 B1 A2 A3 B2 A5 A1 B1 A2 B1 A3 B2 A4 B2 A5 Fixed-priority scheduling; A has priority B has priority Earliest-deadline scheduling using completion deadlines B1 cse321-fall2013 11/27/2018

Aperiodic Task set Arrival Time Execution Time Starting Deadline A 10 20 110 B 20 20 20 C 40 20 50 D 50 20 90 E 60 20 70 Use earliest deadline with unforced idle time cse321-fall2013 11/27/2018

Rate-monotonic scheduling First proposed by Liu. For RMS, the highest-priority task is the one with the shortest period, the second highest-priority task is the one with the second shortest period, and so on. Schedulability according to RMS Σ(Ci/Ti) <= n(21/n-1) cse321-fall2013 11/27/2018

Resources & Critical Resources Shared resources: need mutual exclusion Tasks cooperating to complete a job Tasks contending to access a resource Tasks synchronizing Critical resources and critical region A important synchronization and mutual exclusion primitive / resource is “semaphore” cse321-fall2013 11/27/2018

Critical sections and Semaphores When multiples tasks are executing there may be sections where only one task could execute at a given time: critical region or critical section There may be resources which can be accessed only be one of the processes: critical resource Semaphores can be used to ensure mutual exclusion to critical sections and critical resources cse321-fall2013 11/27/2018

Semaphore Implementation Define a semaphore as a class: class Semaphore { int value; // semaphore value processQueue L; // process queue //operations wait() signal() } In addition, two simple utility operations: block() suspends the process that invokes it. wakeup() resumes the execution of a blocked process P. 11/27/2018

Semantics of wait and signal Semaphore operations now defined as S.wait(): S.value--; if (S.value < 0) { add this process to S.L; block(); // block a process } S.signal(): S.value++; if (S.value <= 0) { remove a process P from S.L; wakeup(); // wake a process 11/27/2018

Semaphores for CS Semaphore is initialized to 1. The first process that executes a wait() will be able to immediately enter the critical section (CS). Now other processes wanting to enter the CS will each execute the wait() thus decrementing the value of S, and will get blocked on S. (If at any time value of S is negative, its absolute value gives the number of processes waiting blocked. ) When a process in CS departs, it executes S.signal() which increments the value of S, and will wake up any one of the processes blocked. The queue could be FIFO or priority queue. 11/27/2018

Semaphores Semaphore init() Semaphore wait() Semaphore signal() cse321-fall2013 11/27/2018

Priority Inversion When we allow concurrent task to execute and with semaphore and mailboxes and other synchronization primitives, it is possible that a low priority task may come to block a high priority task. This situation is known as priority inversion. What happened on Mars? cse321-fall2013 11/27/2018

Priority inversion (Priority: t1>t2>t3) Critical section task1 time 0 1 2 3 4 5 6 7 8 9 10 blocked task2 task3 cse321-fall2013 11/27/2018

Problem: Priority inversion Solution1: Priority Inheritance task1 blocked Task 2 delayed task2 Priority of t1 inherited Critical section Priority reverted To t3 task3 0 1 2 3 4 5 6 7 8 9 10 time cse321-fall2013 11/27/2018

Solution2:Priority Ceiling Protocol CS Used by Priority Ceiling S1 t1,t2 P(t1) S2 t1,t2,t3 S3 t3 P(t3) Solution2:Priority Ceiling Protocol Acquire S1 Release S1 task1 Attempt to Acquire S1 Acquire S1 Acquire S2 No way task2 Acquire S2 Release S2 Critical section task3 0 1 2 3 4 5 6 7 8 9 10 time cse321-fall2013 11/27/2018