Real-Time Systems Resource Access Protocols

Similar documents
Resource Access Control in Real-Time Systems. Resource Access Control in Real-Time Systems

What is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem?

Verification of Real-Time Systems Resource Sharing

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

Introduction to Embedded Systems

The Deadlock Problem. A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.

Deadlocks. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

Chapter 8: Deadlocks. The Deadlock Problem

The Deadlock Problem. Chapter 8: Deadlocks. Bridge Crossing Example. System Model. Deadlock Characterization. Resource-Allocation Graph

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

UNIT:2. Process Management

Microkernel/OS and Real-Time Scheduling

Tasks. Task Implementation and management

What is Deadlock? Two or more entities need a resource to make progress, but will never get that resource. Examples from everyday life:

AUTOSAR Extensions for Predictable Task Synchronization in Multi- Core ECUs

A Stack-Based Resource Allocation Policy for Realtime Processes

Schedulability with resource sharing. Priority inheritance protocol Priority ceiling protocol Stack resource policy

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

CMSC 412. Announcements

Concurrency: Deadlock and Starvation. Chapter 6

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

Chapter 7: Deadlocks

Deadlock. Operating Systems. Autumn CS4023

Chapter 8: Deadlocks. The Deadlock Problem

Deadlocks. Operating System Concepts - 7 th Edition, Feb 14, 2005

Chapter 8: Deadlocks. Bridge Crossing Example. The Deadlock Problem

CHAPTER 6: PROCESS SYNCHRONIZATION

Resource Access Control (2) Real-Time and Embedded Systems (M) Lecture 14

Basics of Deadlock Theory. Deadlocks

Chapter 6. Deadlock. (A Quick Introduction)

Scheduling. The Basics

Operating Systems: Quiz2 December 15, Class: No. Name:

Chapter 8: Deadlocks

Chapter 8: Deadlocks. The Deadlock Problem. System Model. Bridge Crossing Example. Resource-Allocation Graph. Deadlock Characterization

Real-time operating systems and scheduling

Module 7: Deadlocks. The Deadlock Problem. Bridge Crossing Example. System Model

Maximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait

An Improved Priority Ceiling Protocol to Reduce Context Switches in Task Synchronization 1

Lecture 7 Deadlocks (chapter 7)

Operating System: Chap7 Deadlocks. National Tsing-Hua University 2016, Fall Semester

T an important area of research in real-time computer systerns.

Deadlock Prevention. Restrain the ways request can be made. Mutual Exclusion not required for sharable resources; must hold for nonsharable resources.

Deadlock. Concepts to discuss. A System Model. Deadlock Characterization. Deadlock: Dining-Philosophers Example. Deadlock: Bridge Crossing Example

CS450/550 Operating Systems

Chapter 8: Deadlocks. Operating System Concepts with Java

COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 7 Deadlocks. Zhi Wang Florida State University

Chapter 7: Deadlocks

CSE 120. Summer, Inter-Process Communication (IPC) Day 3. Inter-Process Communication (IPC) Scheduling Deadlock. Instructor: Neil Rhodes

Analyzing Real-Time Systems

Chapter 6 Concurrency: Deadlock and Starvation

The Deadlock Problem

The Deadlock Problem

CSE 380 Computer Operating Systems

Real Time Operating System Support for Concurrency

The Deadlock Problem

Operating systems and concurrency (B10)

System Model. Types of resources Reusable Resources Consumable Resources

Deadlock Prevention, Avoidance, and Detection

OPERATING SYSTEMS. Deadlocks

UNIT-5 Q1. What is deadlock problem? Explain the system model of deadlock.

Chapter 7: Deadlocks. Operating System Concepts 8th Edition, modified by Stewart Weiss

Chapter 7: Deadlocks

Subject Teacher: Prof. Sheela Bankar

EXTENDING THE PRIORITY CEILING PROTOCOL USING READ/WRITE AFFECTED SETS MICHAEL A. SQUADRITO A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE

ENGG4420 CHAPTER 2 LECTURE 6

The Deadlock Problem (1)

Deadlock. Lecture 4: Synchronization & Communication - Part 2. Necessary conditions. Deadlock handling. Hierarchical resource allocation

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

Outlook. Deadlock Characterization Deadlock Prevention Deadlock Avoidance

More on Synchronization and Deadlock

Shared and Preemptable Resources. A few resources may be sharable. Anyone can write the system log.

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009!

Deadlock. A Bit More on Synchronization. The Deadlock Problem. Deadlock Characterization. Operating Systems 2/7/2005. CSC 256/456 - Spring

DEADLOCKS M O D E R N O P E R A T I N G S Y S T E M S C H A P T E R 6 S P R I N G

Homework Assignment #5

Silberschatz, Galvin and Gagne 2013! CPU cycles, memory space, I/O devices! " Silberschatz, Galvin and Gagne 2013!

Deadlock. Disclaimer: some slides are adopted from Dr. Kulkarni s and book authors slides with permission 1

Deadlocks. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Final Examination. Thursday, December 3, :20PM 620 PM. NAME: Solutions to Selected Problems ID:

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

Operating Systems 2006/2007

Deadlock Risk Management

Last Class: Monitors. Real-world Examples

Chapter 7: Deadlocks. Chapter 7: Deadlocks. The Deadlock Problem. Chapter Objectives. System Model. Bridge Crossing Example

CS4514 Real Time Scheduling

ICS Principles of Operating Systems. Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems, 3rd edition. Uses content with permission from Assoc. Prof. Florin Fortis, PhD

CHAPTER 7: DEADLOCKS. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Principles of Operating Systems

Deadlock Prevention. Deadlock can be prevented if 1 of the 4 conditions cannot hold

Integrating Real-Time Synchronization Schemes into Preemption Threshold Scheduling

Fig Bridge crossing - deadlock

Operating Systems Antonio Vivace revision 4 Licensed under GPLv3

Deadlock and Starvation

Deadlock 1 Chapter 6

Chapter 7 : 7: Deadlocks Silberschatz, Galvin and Gagne 2009 Operating System Concepts 8th Edition, Chapter 7: Deadlocks

SYNCHRONIZATION M O D E R N O P E R A T I N G S Y S T E M S R E A D 2. 3 E X C E P T A N D S P R I N G 2018

Bridge Crossing Example

csci 3411: Operating Systems

Transcription:

Real-Time Systems Resource Access Protocols WS 2016/17

Problems: Priority Inversion Assumptions: Jobs use resources in a mutually exclusive manner Preemptive priority-driven scheduling Fixed task priorities 1 processor Busy waiting and priority inversion L ready mutex := 0 H ready L preempted mutex = 1? Declaration for the following slides L(R) U(R) H L 2

Problems: Priority Inversion Semaphores and priority inversion L ready L active L: s.p() H ready H active L ready H: s.p() H blocked L active L: s.v() H ready H active L ready H: s.v() H completes L active H L M: medium-prioritized job (not using s) L: s.p() H ready H: s.p() M ready M completes H M L 3

Problems: Timing Anomalies 0 5 10 15 J1 J2 J3 Reduction of resource usage of J3 by 1.5: 0 5 10 15 J1 J2 J3 4

Problems: Deadlocks exclusive resources non-preemptive resources sequential acquire cyclic wait-condition 5

Assumptions and Notations 1 processor, preemptive priority-driven scheduling, jobs are not self-suspending R1,, Rr L(Rk), U(Rk) Rk J1,, Jn Jh, Jl Rk resources; nonpreemptable, exclusive acquire/release of Rk; release: LIFO jobs job of high/low priority p1,, pn assigned priorities (highest priority: 1); w.l.o.g.: Ji ordered according to priorities pi(t) current priority of Ji 6

Assumptions and Notations Jobs conflict with one another operate with a common resource Jobs contend for a resource one job requests the resource that another job already owns Blocked job scheduler does not grant the requested resource Priority inversion Jl executes while Jh is blocked 7

Priority Inheritance Protocol for preemptive priority-driven scheduling Sha et al., 1990 Basic Priority-Inheritance Protocol (1) Scheduling Rule A ready job J is scheduled according to its current priority p(t); at release time t: p(t) := p. (2) Allocation Rule J requests R at time t. (a) R free: R is allocated to J until J releases R. (b) R not free: request is denied, J is blocked. (3) Priority-Inheritance Rule When J becomes blocked by Jl, then Jl inherits the current priority of J, i.e. pl(t) := p(t). Jl executes at this priority until it releases R at time t. Now the priority of Jl returns to its previous priority: pl(t ) := pl(t ) t : time when Jl acquires R. 8

Priority Inheritance Example 2 jobs: no effect! 3 jobs: H ready H: s.p() M ready H M L 9

Priority Inheritance Properties Properties Priority inheritance is transitive. No unbounded uncontrolled priority inversion. Priority inheritance does not reduce the blocking times as small as possible. 10

Priority Inheritance Properties J1 S R R,S J2 S S J3 R R J1 J2 S J3 R J1 J2 J3 R 11

Priority Inheritance Properties Priority inheritance does not prevent deadlocks. J1 J2 S R R S 12

Priority Ceilings Notations Sha/Rajkumar/Lehoczky, 1990 Assumptions and Notations 1 processor, preemptive priority-driven scheduling no self-suspension Assigned priorities pi are fixed priorities: natural numbers, 1 highest, Ω lowest priority The resources required by all jobs are known a priori P(R) priority ceiling of R highest priority of all jobs that require R P(t) ˆ priority ceiling of the system at time t highest priority ceiling of all resources that are in use at time t 13

Basic Priority-Ceiling Protocol (1) Scheduling Rule At release time t rel of J: p(t rel ) := p (2) Allocation Rule J requests R at time t (a) R held by another job: request denied, J blocks ( on R ) (b) R free: (α) p(t) P(t): ˆ R is allocated to J (β) otherwise: R is allocated to J only if J is the job holding the ˆ resource(s) R with P(R ) = P(t), otherwise J blocks (3) Priority-Inheritance Rule When J becomes blocked by Jl, Jl inherits J s current priority p(t) Jl (preemptively) executes at this priority until it releases every resource whose priority ceiling is at least p(t) At that time, Jl s priority returns to pl(t ) (t : time when it was granted the resource) 14

Basic Priority-Ceiling Protocol Properties Difference to priority inheritance: three ways to blocking direct: Jh R Jl inheritance: Jh R J Jl ceilings: Deadlocks can never occur There can be no transitive blocking Jh R free! X Jl 15

Basic Priority-Ceiling Protocol Example A job can be blocked for at most one resource request Computation of blocking time Example: J1 0.8 J2 R J1 J2 J3 J4 J3 1 0.2 S J4 16

Stack-Based Priority-Ceiling Protocol Further Assumptions Common run-time stack for all jobs (no self-suspension) Stack space of an active job is on the top of the stack (preemption) Stack space is freed when the job completes Protocol (0) P(t) ˆ = Ω, when all R are free, P(t) ˆ is updated whenever a resource is allocated or freed (1) Scheduling Rule After J is released, it is blocked until p P(t) ˆ Priority-driven scheduling based on assigned priorities (!) (2) Allocation Rule Whenever a job requests a resource, it is granted the resource (!) Properties When a job begins execution, all resources it will ever need are free Both protocols result in the same longest blocking time of a job Deadlocks cannot occur 17