0 Synchronization Problem Resource sharing –Requires mutual exclusion –Critical section A code section that should be executed mutually exclusively by.

Slides:



Advertisements
Similar presentations
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
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
Washington WASHINGTON UNIVERSITY IN ST LOUIS Resource and Resource Access Control Fred Kuhns Applied Research Laboratory Computer Science and Engineering.
Outline Introduction Assumptions and notations
Introduction to Embedded Systems Resource Management - III Lecture 19.
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.
1 Chapter 5 Concurrency: Mutual Exclusion and Synchronization Principals of Concurrency Mutual Exclusion: Hardware Support Semaphores Readers/Writers Problem.
Overview Assignment 8: hints Assignment 7: solution Deadlocks
LUI SHA,RAGUNATHAN RAJKUMAR,JOHN P.LEHOCZKY IEEE TRANSACTIONS ON COMPUTERS, VOL. 39, NO. 9, SEPTEMBER 1990 Repesent : Shu Wei Ho.
Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
CS5270 Lecture 31 Uppaal, and Scheduling, and Resource Access Protocols CS 5270 Lecture 3.
Resource Access Protocols
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)
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6: Process Synchronization
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Concurrency, Race Conditions, Mutual Exclusion, Semaphores, Monitors, Deadlocks Chapters 2 and 6 Tanenbaum’s Modern OS.
Resource Access Control in Real-Time Systems Resources, Resource Access, and How Things Can Go Wrong: The Mars Pathfinder Incident Resources, Critical.
UCDavis, ecs150 Fall /23/2007ecs150, fall Operating System ecs150 Fall 2007 : Operating System #3: Priority Inversion (a paper on the class.
UCDavis, ecs150 Spring /21/2006ecs150, spring Operating System ecs150 Spring 2006 : Operating System #3: Priority Inversion (paper) Dr. S.
Resource Access Control (Part I) The Mars Pathfinder Incident Resource Model Priority Inversion.
CS533 Concepts of Operating Systems Class 3 Monitors.
Spring 2002Real-Time Systems (Shin) Rate Monotonic Analysis Assumptions – A1. No nonpreemptible parts in a task, and negligible preemption cost –
UCDavis, ecs251 Fall /23/2007ecs251, fall Operating System Models ecs251 Fall 2007 : Operating System Models #3: Priority Inversion Dr. S.
Chapter 4 – Periodic Task Scheduling In many real-time systems periodic tasks dominate the demand. Three classic periodic task scheduling algorithms: –
Introduction to Embedded Systems
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Mutual Exclusion.
Real Time Operating Systems Schedulability - Part 3 Course originally developed by Maj Ron Smith 10/24/2015Dr Alain Beaulieu1.
Real Time Scheduling Telvis Calhoun CSc Outline Introduction Real-Time Scheduling Overview Tasks, Jobs and Schedules Rate/Deadline Monotonic Deferrable.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization.
Real Time Operating Systems Mutual Exclusion, Synchronization & Intertask Communication Course originally developed by Maj Ron Smith.
Chapter 6 – Process Synchronisation (Pgs 225 – 267)
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 2006 Universität Dortmund Periodic scheduling For periodic scheduling, the best that we can do is to.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
Advanced Operating Systems - Spring 2009 Lecture 14 – February 25, 2009 Dan C. Marinescu Office: HEC 439 B. Office.
B. RAMAMURTHY 12/25/2015 Realtime System Fundamentals : Scheduling and Priority-based scheduling Pag e 1.
Introduction to Embedded Systems Rabie A. Ramadan 5.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Sandtids systemer 2.modul el. Henriks 1. forsøg m. Power Point.
Undergraduate course on Real-time Systems Linköping University TDDD07 Real-time Systems Lecture 2: Scheduling II Simin Nadjm-Tehrani Real-time Systems.
Process Synchronization. Objectives To introduce the critical-section problem, whose solutions can be used to ensure the consistency of shared data To.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Process Synchronization.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Outlines  Introduction  Kernel Structure  Porting.
Deadlock and Starvation
Chapter 6: Process Synchronization
COT 4600 Operating Systems Fall 2009
Chapter 5: Process Synchronization
Process Synchronization: Semaphores
Scheduling and Resource Access Protocols: Basic Aspects
Background on the need for Synchronization
Process Synchronization
EEE 6494 Embedded Systems Design
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall2014 9/20/2018.
Chapter 5: Process Synchronization
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy cse321-fall /27/2018.
Topic 6 (Textbook - Chapter 5) Process Synchronization
Threading And Parallel Programming Constructs
Semaphore Originally called P() and V() wait (S) { while S <= 0
Lecture 2 Part 2 Process Synchronization
Realtime System Fundamentals : Scheduling and Priority-based scheduling B. Ramamurthy Amrita-UB-MSES /11/2013.
Resource access control -- example
CHAPTER 8 Resources and Resource Access Control
Presentation transcript:

0 Synchronization Problem Resource sharing –Requires mutual exclusion –Critical section A code section that should be executed mutually exclusively by tasks –Semaphore One of synchronization primitives Assumptions of this paper –Fixed-priority preemptive scheduling –A uniprocessor environment –Binary semaphore (Mutex)

1 Priority Inversion Problem Priority inversion –Phenomenon where a higher priority job is blocked by lower priority jobs Indefinite priority inversion –Occurs when a task of medium priority preempts a task of lower priority which is blocking a task of higher priority.

2 Indefinite Priority Inversion lock S time preempt J3 (try to lock S) blocked by J3 preempt J3      indefinite blocking !     

3 Assumptions No voluntary blocking –Jobs do not suspend themselves, say for I/O operations. Properly nested critical sections –(ex) Properly nested semaphores J i  ..., P  S 1 ,..., P  S 2 ,..., V  S 2 ,..., V  S 1 ,...  J i  ..., P  S 1 ,..., P  S 2 ,..., V  S 1 ,..., V  S 2 ,...  Non-properly nested semaphores

4 Description of Basic Protocol If job J blocks higher priority jobs: –J inherits P H, the highest priority of the jobs blocked by J. Priority inheritance is transitive. –If J 3 blocks J 2 and J 2 blocks J 1, J 3 would inherit the priority of J 1 via J 2. When J exits a critical section: –J resumes the priority it had at the point of entry into the critical section.

5 Examples for Basic Protocol (1/2) lock S time preempt J3 (try to lock S) blocked by J3 preempt J3 (lock S) j3 inherits priority of J1 arrive unlock Scomplete unlock S push-through blocking

6 Examples for Basic Protocol (2/2) J 1  ..., P  S 2 ,..., V  S 2 ,...  J 2  ..., P  S 2 ,..., P  S 1 ,..., V  S 1 ,..., V  S 2 ,...  J 3  ..., P  S 1 ,..., V  S 1 ,...  time preempt J3 (attempt to lock S2) blocked by J2 complete (attempt to lock S1) blocked by J3 unlock S1 unlock S2 unlock S2 lock S2 lock S1 lock S1 unlock S1 lock S2 t0t1t2t3t4t5t6t7t8t9t10t11t12t13 complete transitive blocking nested semaphores

7 Blocking in Basic Protocol Three Types of blocking –Direct blocking Ensures the consistency of shared data. –Push-through blocking Prevents indefinite blocking due to priority inversion –Transitive blocking By not-directly involved semaphores which are accessed in a nested form by blocking jobs. Transitive blocking is said to occur if a job J is blocked by J i which, in turn, is blocked by another job J j.

8 Problems of Basic Protocol Deadlocks –Due to crossing nested semaphores Long blocking delay –Due to Transitive blocking –Blocking by not-directly involved semaphores which are accessed in nested form by blocking jobs. Blocking chains –Blocking can occur sequentially whenever accessing each semaphore.

9 Deadlocks in Basic Protocol J 1  ..., P  S 2 ..., P  S 1 ,...,V  S 1 ...,V  S 2 ,...  J 2  ..., P  S 1 ..., P  S 2 ,...,V  S 2 ...,V  S 1 ,...  lock S1 time preempt J2 lock S2 (try to lock S1) blocked by J2 (try to lock S2) blocked by J1 crossing nested semaphores deadlock!

10 Blocking Chains in Basic Protocol J 1  ..., P  S 1 ,..., V  S 1 ,..., P  S 2 ,..., V  S 2 ,...  J 2  ..., P  S 2 ,..., V  S 2 ,...  J 3  ..., P  S 1 ,..., V  S 1 ,...  time preempt J3 (attempt to lock S1) blocked by J3 complete (attempt to lock S2) blocked by J2 unlock S1 unlock S2 unlock S2 lock S2 lock S1 lock S1 unlock S1 lock S2 t0t1t2t3t4t5t6t7t8t9t10t11t12t13 complete

11 Summary of Basic Protocol Basic Idea –If a job blocks higher priority jobs, it inherits the highest priority of the jobs blocked by it. Three types of blocking –(1) Direct blocking, (2) push-through blocking, and (3) transitive blocking Controlled priority inversion –Upper bound on the total blocking delay that a job can encounter Can be determined by studying the durations of the critical sections in  * i,j and  * i,,k. Problems –Deadlocks –Long blocking delay Due to transitive blocking and blocking chains