Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling 主講人:虞台文.

Slides:



Advertisements
Similar presentations
Operating Systems1 5. Process and thread scheduling 5.1 Organization of Schedulers – Embedded and Autonomous Schedulers 5.2 Scheduling Methods – A Framework.
Advertisements

CHAPTER 5 Organization of Schedulers Scheduling Methods Priority Inversion Multiprocessor and Distributed Scheduling Process and Thread Scheduling.
Operating Systems Chapter 6
Chap 5 Process Scheduling. Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a.
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating Systems CPU Scheduling. Agenda for Today What is Scheduler and its types Short-term scheduler Dispatcher Reasons for invoking scheduler Optimization.
CPU Scheduling Section 2.5.
Chapter 3: CPU Scheduling
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Chapter 8 – Processor Scheduling Outline 8.1 Introduction 8.2Scheduling Levels 8.3Preemptive vs. Nonpreemptive Scheduling 8.4Priorities 8.5Scheduling Objectives.
Scheduling in Batch Systems
CS 3013 & CS 502 Summer 2006 Scheduling1 The art and science of allocating the CPU and other resources to processes.
Chapter 6: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 6: CPU Scheduling Basic.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (2) Process Management 10/03/2008 Yang Song (Prepared by Yang Song and.
Wk 2 – Scheduling 1 CS502 Spring 2006 Scheduling The art and science of allocating the CPU and other resources to processes.
Job scheduling Queue discipline.
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 6: CPU Scheduling
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-3 CPU Scheduling Department of Computer Science and Software Engineering.
CS3530 OPERATING SYSTEMS Summer 2014 Processor Scheduling Chapter 5.
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
Operating Systems Lecture Notes CPU Scheduling Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 Our focus  scheduling a single CPU among all the processes in the system  Key Criteria: Maximize CPU utilization Maximize throughput Minimize waiting.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
ICS Process and thread scheduling 5.1 Organization of Schedulers – Embedded and Autonomous Schedulers – Priority Scheduling 5.2 Scheduling Methods.
CompSci 143A1 5. Process and thread scheduling 5.1 Organization of Schedulers – Embedded and Autonomous Schedulers – Priority Scheduling 5.2 Scheduling.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
Chapter 5: Process Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Basic Concepts Maximum CPU utilization can be obtained.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 5: CPU Scheduling Basic.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Processor Scheduling Hank Levy. 22/4/2016 Goals for Multiprogramming In a multiprogramming system, we try to increase utilization and thruput by overlapping.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Process Scheduling Schedulers and Scheduling Methods.
Operating Systems Scheduling. Scheduling Short term scheduler (CPU Scheduler) –Whenever the CPU becomes idle, a process must be selected for execution.
1 Uniprocessor Scheduling Chapter 3. 2 Alternating Sequence of CPU And I/O Bursts.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Operating Systems Unit 5: – Processor scheduling – Java – Linux – Windows XP Operating Systems.
Lecture 4 CPU scheduling. Basic Concepts Single Process  one process at a time Maximum CPU utilization obtained with multiprogramming CPU idle :waiting.
CPU scheduling.  Single Process  one process at a time  Maximum CPU utilization obtained with multiprogramming  CPU idle :waiting time is wasted 2.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
3. CPU Scheduling. CPU Scheduling Process execution – a cycle of CPU execution and I/O wait – figure Preemptive Non-Preemptive.
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
CPU SCHEDULING.
EEE Embedded Systems Design Process in Operating Systems 서강대학교 전자공학과
Chapter 8 – Processor Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling G.Anuradha
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Operating System Concepts
Chapter5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Chapter 6: CPU Scheduling
Chapter 6: CPU Scheduling
CPU Scheduling: Basic Concepts
Presentation transcript:

Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling 主講人:虞台文

Content Organization of Schedulers – Embedded and Autonomous Schedulers – Priority Scheduling Scheduling Methods – A Framework for Scheduling – Common Scheduling Algorithms – Comparison of Methods Priority Inversion

Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling Organization of Schedulers

Process Scheduling/Dispatching Process scheduling – Long term scheduling – Move process to Ready List (“RL”) after creation (When and in which order?) Process Dispatching – Short term scheduling – Select process from Ready List to run We use “scheduling” to refer to both.

Organization of Schedulers Embedded – Called as function at end of kernel call – Runs as part of calling process Autonomous – Separate process – May have dedicated CPU on a multiprocessor – On single-processor, run at every quantum: scheduler and other processes alternate p i : process S : scheduler

Organization of Schedulers Embedded –C–Called as function at end of kernel call –R–Runs as part of calling process Autonomous –S–Separate process –M–May have dedicated CPU on a multiprocessor –O–On single-processor, run at every quantum: scheduler and other processes alternate OS p1p1 p1p1 S p2p2 p2p2 S p3p3 p3p3 S p4p4 p4p4 S p1p1 p1p1 p2p2 p2p2 p3p3 p3p3 p4p4 p4p4 S S Unix Windows 2000

Priority Scheduling Priority function returns numerical value P for process p : P = Priority(p) Static priority: unchanged for lifetime of p Dynamic priority: changes at runtime Who runs next? Based on priority

Priority-Leveled Processes Priority divides processes into levels Implemented as multilevel ready list, say, RL – p at RL[i] run before q at RL[j] if i > j – p, q at same level are ordered by other criteria, e.g., the order of arrival. RL[n]

The Processes in Ready List Status.Type  {running, ready_a, ready_s}

The Scheduler

The scheduler may be invoked periodically when some events affect the priorities of existing processes, e.g., – a process is blocked/suspended – a process is destroyed – a new process created – a process is activated The scheduler may be invoked periodically when some events affect the priorities of existing processes, e.g., – a process is blocked/suspended – a process is destroyed – a new process created – a process is activated

The Scheduler The scheduler may be invoked periodically when some events affect the priorities of existing processes, e.g., – a process is blocked/suspended – a process is destroyed – a new process created – a process is activated The scheduler may be invoked periodically when some events affect the priorities of existing processes, e.g., – a process is blocked/suspended – a process is destroyed – a new process created – a process is activated Some processes in RL can get CPU. Running processes may be preempted. The scheduler/dispatcher should always keep the np (#processors) highest-priority active processes running.

Invoking the Scheduler The caller to the scheduler may be a process to be blocked/suspended or awakened/activated

Invoking the Scheduler The caller to the scheduler may be a process to be blocked/suspended or awakened/activated

An Embedded Scheduler Scheduler() { do { Find highest priority ready_a process p; Find a free cpu; if (cpu != NIL) Allocate_CPU(p,cpu); } while (cpu != NIL); do { Find highest priority ready_a process p; Find lowest priority running process q; if (Priority(p) > Priority(q)) Preempt(p,q); } while (Priority(p) > Priority(q)); if (self->Status.Type!=’running’) Preempt(p,self); } The caller to the scheduler may be a process to be blocked/suspended or awakened/activated If free CPUs are available, allocate these free CPUs to high- priority processes in ready_a state To preempt low-priority running processes by high-priority ready_a ones. If the caller is going to be idled, preempt itself.

An Embedded Scheduler Scheduler() { do { Find highest priority ready_a process p; Find a free cpu; if (cpu != NIL) Allocate_CPU(p,cpu); } while (cpu != NIL); do { Find highest priority ready_a process p; Find lowest priority running process q; if (Priority(p) > Priority(q)) Preempt(p,q); } while (Priority(p) > Priority(q)); if (self->Status.Type!=’running’) Preempt(p,self); } The caller to the scheduler may be a process to be blocked/suspended or awakened/activated To preempt low-priority running processes by high-priority ready_a ones. If the caller is going to be idled, preempt itself.

An Embedded Scheduler Scheduler() { do { Find highest priority ready_a process p; Find a free cpu; if (cpu != NIL) Allocate_CPU(p,cpu); } while (cpu != NIL); do { Find highest priority ready_a process p; Find lowest priority running process q; if (Priority(p) > Priority(q)) Preempt(p,q); } while (Priority(p) > Priority(q)); if (self->Status.Type!=’running’) Preempt(p,self); } The caller to the scheduler may be a process to be blocked/suspended or awakened/activated If the caller is going to be idled, preempt itself.

An Embedded Scheduler Scheduler() { do { Find highest priority ready_a process p; Find a free cpu; if (cpu != NIL) Allocate_CPU(p,cpu); } while (cpu != NIL); do { Find highest priority ready_a process p; Find lowest priority running process q; if (Priority(p) > Priority(q)) Preempt(p,q); } while (Priority(p) > Priority(q)); if (self->Status.Type!=’running’) Preempt(p,self); } The caller to the scheduler may be a process to be blocked/suspended or awakened/activated

An Embedded Scheduler Scheduler() { do { Find highest priority ready_a process p; Find a free cpu; if (cpu != NIL) Allocate_CPU(p,cpu); } while (cpu != NIL); do { Find highest priority ready_a process p; Find lowest priority running process q; if (Priority(p) > Priority(q)) Preempt(p,q); } while (Priority(p) > Priority(q)); if (self->Status.Type!=’running’) Preempt(p,self); } How to simplify the scheduler for a uniprocessor system?

Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling Scheduling Methods

Scheduling Policy Scheduling based on certain criteria. For examples: – batch jobs vs. interactive users – System processes vs. user processes – I/O bound processes vs. CPU bound processes

The General Framework When to schedule? – Preemptive – Nonpreemptive Who to schedule? – Priority evaluation – Arbitration to break ties Decision Mode Decision mode Priority function Arbitration Rule A scheduling policy is determined by:

The Decision Modes Preemptive: scheduler called – periodically (quantum-oriented) or – when system state changes More costly Nonpreemptive: scheduler called – when process terminates or blocks Not adequate in real-time or time-shared systems Decision mode Priority function Arbitration Rule A scheduling policy is determined by:

The Priority Function Decision mode Priority function Arbitration Rule A scheduling policy is determined by: Possible parameters: – Attained service time (a) – Real time in system (r) – Total service time (t) – Period (d) – Deadline (explicit or implied by period) – External priority (e) – Memory requirements (mostly for batch) – System load (not process-specific)

The Arbitration Rules Decision mode Priority function Arbitration Rule A scheduling policy is determined by: Break ties among processes of the same priority – Random – Chronological (First In First Out = FIFO) – Cyclic (Round Robin = RR)

Common Scheduling Algorithms First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF)

Example Processes for Scheduling First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2

FIFO First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2 CPU does other things Start Scheduling p1p1 p2p2

FIFO First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2 CPU does other things Start Scheduling p1p1 p2p2

SJF First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2 CPU does other things Start Scheduling p1p1 p2p2

SJF First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2 CPU does other things Start Scheduling p1p1 p2p2

SRT First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2 CPU does other things Start Scheduling p1p1 p2p2 p1p1

SRT First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2 CPU does other things Start Scheduling p1p1 p2p2 p1p1

RR First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2 CPU does other things Start Scheduling p1p1 p1p1 Assume a time-quantum of 0.1 time units. p2p2 p1p1

RR First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2 CPU does other things Start Scheduling p1p1 p1p1 Assume a time-quantum of 0.1 time units. p2p2 p1p1

ML First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF)

1 2 n  1 n front rear ML First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) Lowest Highest Each process has a fixed priority.

1 2 n  1 n front rear ML (Nonpreemptive) First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) Lowest Highest Each process has a fixed priority.

1 2 n  1 n front rear ML (Preemptive) First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) Lowest Highest Each process has a fixed priority.

ML (Nonpreemptive) First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) p1p1 p2p2 e p1 = 15 e p2 = 14 CPU does other things Start Scheduling p1p1 p2p2

MLF Like ML, but priority changes dynamically Every process enters at highest level n Each level P prescribes maximum time t P t P increases as P decreases Typically: t n = T (constant) t P = 2  t P+1 First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF)

MLF The priority of a process is a function of a. Find P for given a: priority attained time na<T n – 1 a<T+2T n – 2 a<T+2T+4T... n – i a<(2 i+1 –1)T First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) a : attained service time P = n – i = n –  lg 2 (a/T+1) 

MLF The priority of a process is a function of a. Find P for given a: priority attained time na<T n – 1 a<T+2T n – 2 a<T+2T+4T... n – i a<(2 i+1 –1)T First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) a : attained service time P = n – i = n –  lg 2 (a/T+1) 

RM & EDF First-In/First-Out (FIFO) Shortest-Job-First (SJF) Shortest-Remaining-Time (SRT) Round-Robin (RR) Multilevel Priority (ML) Multilevel Feedback (MLF) Rate Monotonic (RM) Earliest Deadline (EDF) RM – Intended for periodic (real-time) processes – Preemptive – Highest priority: shortest period: P = –d EDF – Intended for periodic (real-time) processes – Preemptive – Highest priority: shortest time to next deadline r  d number of completed periods r % d time in current period d – r % d time remaining in current period P = –(d – r % d)

Common Scheduling Algorithms

Comparison of Methods FIFO, SJF, SRT: Primarily for batch systems FIFO is the simplest SJF & SRT have better average turnaround times: r i : the real time that the i th process spends in the system.

Example arrival service p1p1 p2p2 p3p3 t t t  Comparison of average turnaround time

Comparison of Methods Time-sharing systems Response time is critical RR or MLF with RR within each queue are suitable Time-sharing systems Response time is critical RR or MLF with RR within each queue are suitable

Comparison of Methods Time-sharing systems – Response time is critical – RR or MLF with RR within each queue are suitable Choice of quantum determines overhead – When q  , RR approaches FIFO – When q  0, context switch overhead  100% – When q >> context switch overhead, n processes run concurrently at 1/n CPU speed

Interactive Systems Most dynamic schemes tend to move interactive and I/O-bound processes to the top of the priority queues and to let CPU-bound processes drift to lower levels. MLF puts I/O-completed processes into highest priority queue.

Comparison of Methods Real-time systems –Feasible = All deadlines are met –CPU utilization is defined as: U=∑ t i /d i –Schedule is feasible if U  1 –EDF always yields feasible schedule (if U  1 ) –RM yields feasible schedule if U  0.7 Real-time systems –Feasible = All deadlines are met –CPU utilization is defined as: U=∑ t i /d i –Schedule is feasible if U  1 –EDF always yields feasible schedule (if U  1 ) –RM yields feasible schedule if U  0.7

Example: RM and EDF p1p1 p2p2 CPU Utilization p1p1 p2p2 RM p1p1 p2p2 EDF

Example: RM and EDF p2p2 CPU Utilization p1p1 p2p2 RM p1p1 p2p2 EDF p1p1  fail

Operating Systems Principles Process Management and Coordination Lecture 5: Process and Thread Scheduling Priority Inversion

Priority Inversion Problem p1p1 P(mutex) CS_1 V(mutex) Program1 p2p2 Program2 p3p3 P(mutex) CS_3 V(mutex) Program3 Assume priority order p 1 > p 2 > p 3. p 1 and p 3 share common resource. p 2 is independent of p 1 and p 3.

Priority Inversion Problem Assume priority order p 1 > p 2 > p 3. p 1 and p 3 share common resource. p 2 is independent of p 1 and p 3.

Priority Inversion Problem Assume priority order p 1 > p 2 > p 3. p 1 and p 3 share common resource. p 2 is independent of p 1 and p 3.              

Priority Inversion Problem Assume priority order p 1 > p 2 > p 3. p 1 and p 3 share common resource. p 2 is independent of p 1 and p 3.               (Unrelated) p 2 may delay p 1 indefinitely.

Solutions 1. Make CSs nonpreemptable Practical is CSs are short and few Unsatisfactory if high-priority process often found themselves waiting for lower-priority process, especially unrelated ones. 2. Naïve “solution”: Always run CS at priority of highest process that shares the CS Problem: p 1 cannot preempt lower-priority process inside CS, even when it does not try to enter CS -- a different form of priority inversion. 3. Dynamic Priority Inheritance See Next

Dynamic Priority Inheritance p 3 is in its CS p 1 attempts to enter its CS p 3 inherits p 1 ’s (higher) priority for the duration of CS Sha, Rajkumar, and Lehocsky 1990 Assume priority order p 1 > p 2 > p 3. p 1 and p 3 share common resource. p 2 is independent of p 1 and p 3.

Dynamic Priority Inheritance p 3 is in its CS p 1 attempts to enter its CS p 3 inherits p 1 ’s (higher) priority for the duration of CS Assume priority order p 1 > p 2 > p 3. p 1 and p 3 share common resource. p 2 is independent of p 1 and p 3.

Dynamic Priority Inheritance p 3 is in its CS p 1 attempts to enter its CS p 3 inherits p 1 ’s (higher) priority for the duration of CS Assume priority order p 1 > p 2 > p 3. p 1 and p 3 share common resource. p 2 is independent of p 1 and p 3.              

References Rensselaer Polytechnic Institute University of east London Inside the Windows NT Scheduler, Part 1 Inside the Windows NT Scheduler, Part 2